Loading django/contrib/auth/migrations/0003_alter_user_email_max_length.py 0 → 100644 +19 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('auth', '0002_alter_permission_name_max_length'), ] operations = [ migrations.AlterField( model_name='user', name='email', field=models.EmailField(max_length=254, verbose_name='email address', blank=True), ), ] django/core/validators.py +3 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,9 @@ class EmailValidator(object): r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string re.IGNORECASE) domain_regex = re.compile( r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))$', # max length of the domain is 251: 254 (max email length) minus one # period and two characters for the TLD. r'(?:[A-Z0-9](?:[A-Z0-9-]{0,249}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))$', re.IGNORECASE) literal_regex = re.compile( # literal form, ipv4 or ipv6 address (SMTP 4.1.3) Loading django/db/models/fields/__init__.py +2 −4 Original line number Diff line number Diff line Loading @@ -1567,10 +1567,8 @@ class EmailField(CharField): description = _("Email address") def __init__(self, *args, **kwargs): # max_length should be overridden to 254 characters to be fully # compliant with RFCs 3696 and 5321 kwargs['max_length'] = kwargs.get('max_length', 75) # max_length=254 to be compliant with RFCs 3696 and 5321 kwargs['max_length'] = kwargs.get('max_length', 254) super(EmailField, self).__init__(*args, **kwargs) def deconstruct(self): Loading docs/ref/models/fields.txt +4 −8 Original line number Diff line number Diff line Loading @@ -535,18 +535,14 @@ The default form widget for this field is a :class:`~django.forms.TextInput`. ``EmailField`` -------------- .. class:: EmailField([max_length=75, **options]) .. class:: EmailField([max_length=254, **options]) A :class:`CharField` that checks that the value is a valid email address. .. admonition:: Incompliance to RFCs .. versionchanged:: 1.8 The default 75 character ``max_length`` is not capable of storing all possible RFC3696/5321-compliant email addresses. In order to store all possible valid email addresses, a ``max_length`` of 254 is required. The default ``max_length`` of 75 exists for historical reasons. The default has not been changed in order to maintain backwards compatibility with existing uses of :class:`EmailField`. The default ``max_length`` was increased from 75 to 254 in order to be compliant with RFC3696/5321. ``FileField`` ------------- Loading docs/releases/1.8.txt +11 −0 Original line number Diff line number Diff line Loading @@ -373,6 +373,17 @@ lookups:: ... ValueError: Cannot query "<Book: Django>": Must be "Author" instance. Default ``EmailField.max_length`` increased to 254 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The old default 75 character ``max_length`` was not capable of storing all possible RFC3696/5321-compliant email addresses. In order to store all possible valid email addresses, the ``max_length`` has been increased to 254 characters. You will need to generate and apply database migrations for your affected models (or add ``max_length=75`` if you wish to keep the length on your current fields). A migration for :attr:`django.contrib.auth.models.User.email` is included. Miscellaneous ~~~~~~~~~~~~~ Loading Loading
django/contrib/auth/migrations/0003_alter_user_email_max_length.py 0 → 100644 +19 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('auth', '0002_alter_permission_name_max_length'), ] operations = [ migrations.AlterField( model_name='user', name='email', field=models.EmailField(max_length=254, verbose_name='email address', blank=True), ), ]
django/core/validators.py +3 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,9 @@ class EmailValidator(object): r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string re.IGNORECASE) domain_regex = re.compile( r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))$', # max length of the domain is 251: 254 (max email length) minus one # period and two characters for the TLD. r'(?:[A-Z0-9](?:[A-Z0-9-]{0,249}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))$', re.IGNORECASE) literal_regex = re.compile( # literal form, ipv4 or ipv6 address (SMTP 4.1.3) Loading
django/db/models/fields/__init__.py +2 −4 Original line number Diff line number Diff line Loading @@ -1567,10 +1567,8 @@ class EmailField(CharField): description = _("Email address") def __init__(self, *args, **kwargs): # max_length should be overridden to 254 characters to be fully # compliant with RFCs 3696 and 5321 kwargs['max_length'] = kwargs.get('max_length', 75) # max_length=254 to be compliant with RFCs 3696 and 5321 kwargs['max_length'] = kwargs.get('max_length', 254) super(EmailField, self).__init__(*args, **kwargs) def deconstruct(self): Loading
docs/ref/models/fields.txt +4 −8 Original line number Diff line number Diff line Loading @@ -535,18 +535,14 @@ The default form widget for this field is a :class:`~django.forms.TextInput`. ``EmailField`` -------------- .. class:: EmailField([max_length=75, **options]) .. class:: EmailField([max_length=254, **options]) A :class:`CharField` that checks that the value is a valid email address. .. admonition:: Incompliance to RFCs .. versionchanged:: 1.8 The default 75 character ``max_length`` is not capable of storing all possible RFC3696/5321-compliant email addresses. In order to store all possible valid email addresses, a ``max_length`` of 254 is required. The default ``max_length`` of 75 exists for historical reasons. The default has not been changed in order to maintain backwards compatibility with existing uses of :class:`EmailField`. The default ``max_length`` was increased from 75 to 254 in order to be compliant with RFC3696/5321. ``FileField`` ------------- Loading
docs/releases/1.8.txt +11 −0 Original line number Diff line number Diff line Loading @@ -373,6 +373,17 @@ lookups:: ... ValueError: Cannot query "<Book: Django>": Must be "Author" instance. Default ``EmailField.max_length`` increased to 254 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The old default 75 character ``max_length`` was not capable of storing all possible RFC3696/5321-compliant email addresses. In order to store all possible valid email addresses, the ``max_length`` has been increased to 254 characters. You will need to generate and apply database migrations for your affected models (or add ``max_length=75`` if you wish to keep the length on your current fields). A migration for :attr:`django.contrib.auth.models.User.email` is included. Miscellaneous ~~~~~~~~~~~~~ Loading