Opened 4 years ago

Closed 4 years ago

#21531 closed Bug (invalid)

Django 1.6 forms.SlugField validation error

Reported by: 20tab Owned by: nobody
Component: Forms Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



I have a problem with SlugField.

In my model I have this field: slug = models.SlugField(_(u'Slug'), blank=True, null=True)

Adding an item through admin, django catches this error:

Django Version: 1.6
Exception Type: AttributeError
Exception Value:
'NoneType' object has no attribute 'strip'
Exception Location: myvirtualenv/lib/python2.7/site-packages/django/forms/ in clean, line 1142

Is this a bug or my fault?

I tried the same code with django 1.5.5 and it works.


Change History (7)

comment:1 Changed 4 years ago by Florian Apolloner

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by Florian Apolloner

Resolution: needsinfo
Severity: Release blockerNormal
Status: newclosed

I just tested against, 1.6, stable/1.6.x and master; can't reproduce it -- can you provide more information?

comment:3 Changed 4 years ago by 20tab

The problem is that I use django-modeltranslation and SlugField doesn't work with all languages.

This is my code:


from django.db import models

class News(models.Model):

title = models.CharField(max_length=250)
slug = models.SlugField(blank=True, null=True)

def unicode(self):

return self.title


from django.contrib import admin

class NewsAdmin(admin.ModelAdmin):

list_display = ('title',)
prepopulated_fields = {'slug': ('title',)}, NewsAdmin)


from modeltranslation.translator import translator, TranslationOptions
from test.models import News

class NewsTranslationOptions(TranslationOptions):

fields = ('title', 'slug')

translator.register(News, NewsTranslationOptions)

Maybe I have to inform django-modeltranslation's developers and I'll do it. But maybe a simple if statement can resolve this problem.

Anyway, thank you so much.

comment:4 Changed 4 years ago by 20tab

Resolution: needsinfo
Status: closednew

comment:5 Changed 4 years ago by anonymous

It's modeltranslation related.

comment:6 Changed 4 years ago by Tim Graham

Then the ticket should be closed, correct?

comment:7 Changed 4 years ago by Tim Graham

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top