diff options
| author | Tim Graham <timograham@gmail.com> | 2015-10-28 15:59:17 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-29 08:58:49 -0400 |
| commit | 15ef1dd478c5b6f005e5f782b7619f718ed55e84 (patch) | |
| tree | ecc98318982921d1bd0d0bb2fd0fc83742614024 /django | |
| parent | 0bd067d0950f49ea586b9c2f0cc74fee24b1d3e9 (diff) | |
Fixed #20846 -- Increased User.username max_length to 254 characters.
Thanks Collin Anderson and Nick Sandford for work on the patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/migrations/0008_alter_user_username_max_length.py | 32 | ||||
| -rw-r--r-- | django/contrib/auth/models.py | 4 |
2 files changed, 34 insertions, 2 deletions
diff --git a/django/contrib/auth/migrations/0008_alter_user_username_max_length.py b/django/contrib/auth/migrations/0008_alter_user_username_max_length.py new file mode 100644 index 0000000000..56705fa58f --- /dev/null +++ b/django/contrib/auth/migrations/0008_alter_user_username_max_length.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0007_alter_validators_add_error_messages'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='username', + field=models.CharField( + error_messages={'unique': 'A user with that username already exists.'}, + help_text='Required. 254 characters or fewer. Letters, digits and @/./+/-/_ only.', + max_length=254, + unique=True, + validators=[ + django.core.validators.RegexValidator( + '^[\\w.@+-]+$', 'Enter a valid username. ' + 'This value may contain only letters, numbers and @/./+/-/_ characters.' + ), + ], + verbose_name='username', + ), + ), + ] diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 070d7d4435..dfa76977d7 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -303,9 +303,9 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): """ username = models.CharField( _('username'), - max_length=30, + max_length=254, unique=True, - help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'), + help_text=_('Required. 254 characters or fewer. Letters, digits and @/./+/-/_ only.'), validators=[ validators.RegexValidator( r'^[\w.@+-]+$', |
