allow longer usernames

This commit is contained in:
j 2011-10-04 18:21:24 +02:00
parent d9e9d56457
commit 5c4e5d00b6
3 changed files with 14 additions and 0 deletions

View file

View file

@ -0,0 +1,13 @@
from django.contrib.auth.models import User
from django.core.validators import MaxLengthValidator
NEW_USERNAME_LENGTH = 255
def monkey_patch_username():
username = User._meta.get_field("username")
username.max_length = NEW_USERNAME_LENGTH
for v in username.validators:
if isinstance(v, MaxLengthValidator):
v.limit_value = NEW_USERNAME_LENGTH
monkey_patch_username()

View file

@ -109,6 +109,7 @@ TEMPLATE_DIRS = (
)
INSTALLED_APPS = (
'monkey_patch',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',