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/fields.py in clean, line 1142
Is this a bug or my fault?
I tried the same code with django 1.5.5 and it works.
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/21531>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* severity: Normal => Release blocker
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:1>
* status: new => closed
* resolution: => needsinfo
* severity: Release blocker => Normal
Comment:
I just tested against, 1.6, stable/1.6.x and master; can't reproduce it --
can you provide more information?
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:2>
Comment (by 20tab):
The problem is that I use django-modeltranslation and SlugField doesn't
work with all languages.
This is my code:
1) models.py
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
2) admin.py
from django.contrib import admin
class NewsAdmin(admin.ModelAdmin):
list_display = ('title',)
prepopulated_fields = {'slug': ('title',)}
admin.site.register(News, NewsAdmin)
3) translation.py
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:3>
* status: closed => new
* resolution: needsinfo =>
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:4>
Comment (by anonymous):
It's modeltranslation related.
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:5>
Comment (by timo):
Then the ticket should be closed, correct?
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:6>
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:7>