Extending django.contrib.auth.models Group name to be 191 character max_length

147 views
Skip to first unread message

Tim Allen

unread,
Nov 13, 2018, 10:52:24 AM11/13/18
to Django developers (Contributions to Django itself)
Greetings,

Over the past few releases, several CharFields in django.contrib.auth have been increased to a max_length of 191: username, first_name, and last_name immediately come to mind.


I've issued a PR to extend Group.name to the same length here: https://github.com/django/django/pull/10627 The original ticket this is addressing was from a colleague who was bumping into the limit when syncing groups to Django from LDAP: https://code.djangoproject.com/ticket/29939

The 191 character limit was chosen to support MySQL index limits.

Can anyone think of a reason not to change Group.name to be max_length=191 as we have with the other fields?

Regards,

Tim

joh...@alumni.upenn.edu

unread,
Nov 13, 2018, 11:09:15 AM11/13/18
to Django developers (Contributions to Django itself)
If the other fields are also 191, i see no reason not to make the change.  It should be a non-breaking change.  And Yes i am that colleague...

Aymeric Augustin

unread,
Nov 14, 2018, 2:41:08 AM11/14/18
to django-d...@googlegroups.com
That seems all right to me.

-- 
Aymeric.



-- 
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1f00582c-452c-4d56-9450-967a31818bea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlton Gibson

unread,
Nov 14, 2018, 3:04:18 AM11/14/18
to Django developers (Contributions to Django itself)
(Before I start, I'm +1 but... 🙂)

Just having a quick go over the history here...

* Original discussion floated a change to 100 or 150 chars. 
    * Aymeric valued fixing the issue for 99.999% of cases. 
    * Tom Christie wanted an "human value", not a machine one. 100 chars was suggested. 
    * Florian said 150 chars, still human, a bit longer. 
    * This didn't get resolved. 

* Comment at https://code.djangoproject.com/ticket/20846#comment:25 begins, "This patch breaks on MySQL..." — some discussion of using 191 chars. 


Current state of play is that username and last_name are 150 chars. first_name is still 30 chars. 

I don't know what's going on with first_name but I think 150 chars is the go-to value here. 

(Hey, nice 🚲 🙂)

Regards,

Carlton


Tim Allen

unread,
Nov 14, 2018, 2:50:10 PM11/14/18
to Django developers (Contributions to Django itself)
I've amended the PR to be 150 characters rather than 191.

Thanks for doing the digging which explains why I had 191 characters stuck in my head. I'm in the "as long as possible to cover the most possible cases" camp, but 150 would seem to hit the 99.99999%, so let's call it a win! 
🎉

Regards,

Tim
Reply all
Reply to author
Forward
0 new messages