diff --git a/pandora/monkey_patch/__init__.py b/pandora/monkey_patch/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pandora/monkey_patch/models.py b/pandora/monkey_patch/models.py new file mode 100644 index 00000000..a39d2a5c --- /dev/null +++ b/pandora/monkey_patch/models.py @@ -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() diff --git a/pandora/settings.py b/pandora/settings.py index 7a68aec1..1294432f 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -109,6 +109,7 @@ TEMPLATE_DIRS = ( ) INSTALLED_APPS = ( + 'monkey_patch', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions',