The length of Permission.name field in django.contrib.auth module is not enough.

307 views
Skip to first unread message

Burak Emre Kabakcı

unread,
Nov 16, 2013, 1:11:39 PM11/16/13
to django-d...@googlegroups.com
The name field in Permission model in django.contrib.auth module causes problems when one of the fields' verbose_name length is larger than 39 characters because it's maximum length is 50. (https://github.com/django/django/blob/master/django/contrib/auth/models.py#L63)
Django automatically prepend "Can change", "Can delete" and "Can add" words to fields' verbose names for name column when inserting rows to auth_permission table so limits the maximum length of a verbose name to 39 character.
When syncdb command is run, Django throws a database exception saying "Data truncated for column 'name' at row x" in this case. I think the length of name field is quite low but if you prefer to limit that field to 50 character, Django should not allow verbose name attribute to be larger than 39 character.

Aymeric Augustin

unread,
Nov 16, 2013, 1:52:18 PM11/16/13
to django-d...@googlegroups.com
Hi Burak,

This limitation has been known for a long time. It’s tracked here:

Your second suggestion was implemented a few weeks ago:

-- 
Aymeric.



--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a6266504-6339-46fb-8774-bc4254f24037%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Burak Emre Kabakcı

unread,
Nov 16, 2013, 2:25:33 PM11/16/13
to django-d...@googlegroups.com
Hi Aymeric,

Sorry for the duplication. It seems the patch is not merged for 1.6 release.

Burak Emre

Aymeric Augustin

unread,
Nov 16, 2013, 2:37:28 PM11/16/13
to django-d...@googlegroups.com
On 16 nov. 2013, at 20:25, Burak Emre Kabakcı <emrek...@gmail.com> wrote:

> Sorry for the duplication. It seems the patch is not merged for 1.6 release.

Indeed, the 1.6 branch was forked from the development branch a few months ago, before that change was committed.

--
Aymeric.

Reply all
Reply to author
Forward
0 new messages