[Django] #21531: Django 1.6 forms.SlugField validation error

23 views
Skip to first unread message

Django

unread,
Nov 29, 2013, 8:48:45 AM11/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
----------------------------+--------------------
Reporter: 20tab | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
Hi,

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.

Django

unread,
Nov 29, 2013, 9:16:24 AM11/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
---------------------------------+------------------------------------

Reporter: 20tab | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by apollo13):

* 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>

Django

unread,
Nov 29, 2013, 9:30:09 AM11/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+-------------------------------------
Reporter: 20tab | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+-------------------------------------
Changes (by apollo13):

* 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>

Django

unread,
Dec 29, 2013, 10:33:11 AM12/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+-------------------------------------
Reporter: 20tab | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6

Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+-------------------------------------

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>

Django

unread,
Dec 29, 2013, 10:33:29 AM12/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+------------------------------------

Reporter: 20tab | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by 20tab):

* status: closed => new
* resolution: needsinfo =>


--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:4>

Django

unread,
Dec 29, 2013, 4:14:52 PM12/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+------------------------------------

Reporter: 20tab | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------

Comment (by anonymous):

It's modeltranslation related.

--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:5>

Django

unread,
Dec 29, 2013, 7:49:02 PM12/29/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+------------------------------------

Reporter: 20tab | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------

Comment (by timo):

Then the ticket should be closed, correct?

--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:6>

Django

unread,
Dec 31, 2013, 6:38:15 AM12/31/13
to django-...@googlegroups.com
#21531: Django 1.6 forms.SlugField validation error
------------------------+------------------------------------
Reporter: 20tab | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by timo):

* status: new => closed

* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/21531#comment:7>

Reply all
Reply to author
Forward
0 new messages