Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #17870 -- Documented that EmailField default max_length of 75 d…

…oes not comply with RFCs 3696/5321. Thanks Rotund for the report and the patch and Russell Keith-Magee for the review.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 31e84e40f8e4c5e6d4fb4bd9276d2e535545fa33 1 parent 159d1be
@claudep claudep authored
Showing with 12 additions and 0 deletions.
  1. +3 −0  django/db/models/fields/__init__.py
  2. +9 −0 docs/ref/models/fields.txt
View
3  django/db/models/fields/__init__.py
@@ -890,6 +890,9 @@ class EmailField(CharField):
description = _("E-mail 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)
CharField.__init__(self, *args, **kwargs)
View
9 docs/ref/models/fields.txt
@@ -481,6 +481,15 @@ The admin represents this as an ``<input type="text">`` (a single-line input).
A :class:`CharField` that checks that the value is a valid email address.
+.. admonition:: Incompliance to RFCs
+
+ 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`.
+
``FileField``
-------------

0 comments on commit 31e84e4

Please sign in to comment.
Something went wrong with that request. Please try again.