Change Django Auth User Meta

Posted: April 29th, 2010 | Author: Arif Harbott | Filed under: Django | Tags: , , | No Comments »

Sometimes it can be helpful to change the default behaviour of the Auth User model or other models built into Django.
One use case might be if you want to change the length of the username field in the Auth User model to allow for longer usernames (e.g. an email address).

There is a simple way to change the max length attribute:

from django.contrib.auth.models import User
User._meta.get_field_by_name('username')[0].max_length=75


Leave a Reply