Opened 3 years ago

Closed 3 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 3 years ago by apollo13

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by apollo13

  • Resolution set to needsinfo
  • Severity changed from Release blocker to Normal
  • Status changed from new to closed

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

comment:3 Changed 3 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 3 years ago by 20tab

  • Resolution needsinfo deleted
  • Status changed from closed to new

comment:5 Changed 3 years ago by anonymous

It's modeltranslation related.

comment:6 Changed 3 years ago by timo

Then the ticket should be closed, correct?

comment:7 Changed 3 years ago by timo

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top