root / monkey_patch / models.py @ 97e42c7d
History | View | Annotate | Download (402 Bytes)
1 |
from django.contrib.auth.models import User |
---|---|
2 |
from django.core.validators import MaxLengthValidator |
3 |
|
4 |
NEW_USERNAME_LENGTH = 255
|
5 |
|
6 |
def monkey_patch_username(): |
7 |
username = User._meta.get_field("username")
|
8 |
username.max_length = NEW_USERNAME_LENGTH |
9 |
for v in username.validators: |
10 |
if isinstance(v, MaxLengthValidator): |
11 |
v.limit_value = NEW_USERNAME_LENGTH |
12 |
|
13 |
monkey_patch_username() |