Ticket #17870: Ticket17870.patch

File Ticket17870.patch, 1.3 KB (added by Joe Tennies, 13 years ago)

Patches documentation and adds comment to init of models.EmailField

  • django/db/models/fields/__init__.py

    diff -r c8373c5e600e django/db/models/fields/__init__.py
    a b  
    890890    description = _("E-mail address")
    891891
    892892    def __init__(self, *args, **kwargs):
     893        # max_length should be overridden to 254 characters to be fully
     894        # compliant with RFCs 3696 and 5321
     895
    893896        kwargs['max_length'] = kwargs.get('max_length', 75)
    894897        CharField.__init__(self, *args, **kwargs)
    895898
  • docs/ref/models/fields.txt

    diff -r c8373c5e600e docs/ref/models/fields.txt
    a b  
    481481
    482482A :class:`CharField` that checks that the value is a valid email address.
    483483
     484.. admonition:: Incompliance to RFCs
     485
     486    The default value of ``max_length`` is not compliant with RFCs 3696 and
     487    5321. It is suggested that new projects override the ``max_length`` to 254
     488    characters, as this would be capable of storing all email addresses as
     489    defined by RFCs 3696 and 5321.
     490   
     491    The default value is not being changed at this time to maintain backward
     492    compatibility with previous versions of Django.
     493
    484494``FileField``
    485495-------------
    486496
Back to Top