Opened 3 years ago

Closed 3 years ago

#18123 closed Bug (duplicate)

username field capped at 30 characters

Reported by: marqh Owned by: nobody
Component: contrib.auth Version: 1.4
Severity: Normal Keywords: username max_length
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


in Django 1.3 and 1.4:


defines a class:

class User(models.Model):


username = models.CharField(_('username'), max_length=30, unique=True,help_text=_('Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters'))

first_name = models.CharField(_('first name'), max_length=30, blank=True)

last_name = models.CharField(_('last name'), max_length=30, blank=True)

I am using kerberos authentication to provide single sign on to my Django provided web applications. I thus obtain a username from the kerberos user management system, which has a form:


this easily exceeds the 30 character limit, meaning that new users cannot be recreated.

Django appears to forbid the overriding of theses fields (which i tried) so my fix involved patching the Django source to enable username to be 100 characters.

I would like to see this in change incorporated into the Django release, so that I can remove my build patch. Is there a reason for such a small character limit which would make this a bad idea?

Change History (1)

comment:1 Changed 3 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the report. This has long been a known issue, but finding a path forward for fixing it is non-trivial due to the requirement of a database migration for all existing installations of Django. The issue was recently discussed at length on the django-developers mailing list, and a path forward was chosen that will result in a fix for this problem. That work is being tracked by ticket #3011, so I'm closing this as a duplicate of that.

Note: See TracTickets for help on using tickets.
Back to Top