Search code examples
pythondjangodjango-modelsdjango-1.7

Easiest and quickest way to increase Django's default username max length from 30 to 75


so i have seen a lot of solutions but i found most answers for older versions of Django and i was wondering if there are any changes on that.

Basically i am using Django 1.7, and i wanted to override the uusername field in the default django USER class to allow more than 30 chars i.e max_length=75.

Should i be using AbstractBaseUser instead or is there an easier way to put max_length=75


Solution

  • Yeah I think you are going to have to go down the custom user route.

    You can take a look here for some inspiration https://github.com/jcugat/django-custom-user that package implements contrib.auth.User except with no username and just using email. You can probably work out how to do what you want from there.

    A similar question was posted where a user detailed a very hacky work around but it might get you by in a pinch: Longer username in Django 1.7