Opened 13 years ago
Closed 13 years ago
#17870 closed Bug (fixed)
Documentation for EmailField max_length
Reported by: | Joe Tennies | Owned by: | Joe Tennies |
---|---|---|---|
Component: | Documentation | Version: | 1.4-beta-1 |
Severity: | Normal | Keywords: | |
Cc: | joe@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
There has been discussion on the Django-develop mailing list about the default max_length of the EmailField. The RFCs allow for 254 octets. This can allow for a maximum of 254 characters. Post 1.4, someone may decide to have the EmailField properly handle the encoding information if a character would use multiple bytes, but in the meantime the documentation should be updated to add the following note to the EmailField.
The default 75 character max_length is not capable of storing all RFC3696/5321 email addresses. A max_length of 254 would be capable of storing all email addresses as defined by the RFC3696/5321 specification. This is not being changed at this time to maintain backwards compatibility.
Attachments (2)
Change History (5)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
by , 13 years ago
Attachment: | Ticket17870.patch added |
---|
Patches documentation and adds comment to init of models.EmailField
comment:2 by , 13 years ago
Cc: | added |
---|---|
Has patch: | set |
Just saw your comment, Russell. I changed the wording when I redid it to the following before seeing your comment:
Incompliance to RFCs
The default value of max_length is not compliant with RFCs 3696 and 5321. It is suggested that new projects override the max_length to 254 characters, as this would be capable of storing all email addresses as defined by RFCs 3696 and 5321.
The default value is not being changed at this time to maintain backward compatibility with previous versions of Django.
To be clear: the proposal is to add the new text as a a note/admonition to the EmailField API reference. Marking RFC because it's a simple addition, and it's worth pointing out this constraint.
However, I'd slightly modify the text:
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 EmailField.