that.dork.jordan
Longer Django usernames (using email addresses)

My new job involves a whole lot of Django development. While we were testing the first version of our new site just before launch we stumbled across an interesting limitation of Django: The included django.contrib.auth package limits usernames to 30 characters and this can not be over-ridden easily. Thirty characters may seem like a lot for a username but if you want to use email addresses as your login identifier it can easily become a problem. 

So I found myself in the office at 8pm digging through Django’s source code to find all the locations where the character limit is hardcoded in such a manner that it can not be overridden. There aren’t many but there are a few and it is honestly quite annoying that these values are hard coded. Eventually I’d like to contribute changes to the project that will allow you to change the limit more easily but for now I’ve attached a patch that can be used against Django 1.02 and will allow for up to 75 characters in the username.Django 75 character username limit patch

Applying is as simple as dropping the diff in the django/contrib/auth directory and running patch -R < django-75-char-username.diff

Django 75 character username limit patch

Share
You can leave a response, or trackback from your own site.