Django auth: increasing max username length

GabiMe picture GabiMe · Jan 14, 2011 · Viewed 18.7k times · Source

I need to increase the max username size in auth to exceed the 30 chars defined in the model. How can it be done? I' m not sure that just customizing the model is the right or safe way.

Answer

Yuji 'Tomita' Tomita picture Yuji 'Tomita' Tomita · Jan 14, 2011

This answer here is an interesting approach: Can django's auth_user.username be varchar(75)? How could that be done?

A small app that overrides the max_length attribute on the User model, but note your DB column needs to be modified if the tables are not being syncdbed

I personally use a trimmed hash as my username which would notify me if there was ever a super unlikely collision, with the subject "You just won the lottery!"