allow longer usernames
This commit is contained in:
parent
d9e9d56457
commit
5c4e5d00b6
3 changed files with 14 additions and 0 deletions
0
pandora/monkey_patch/__init__.py
Normal file
0
pandora/monkey_patch/__init__.py
Normal file
13
pandora/monkey_patch/models.py
Normal file
13
pandora/monkey_patch/models.py
Normal 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()
|
|
@ -109,6 +109,7 @@ TEMPLATE_DIRS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
|
'monkey_patch',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
|
Loading…
Reference in a new issue