Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django auth: increasing max username length

Tags:

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.

like image 271
GabiMe Avatar asked Jan 14 '11 18:01

GabiMe


1 Answers

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!"

like image 187
Yuji 'Tomita' Tomita Avatar answered Oct 13 '22 00:10

Yuji 'Tomita' Tomita