Ticket #12488: email_input.diff

File email_input.diff, 1.9 KB (added by Oliver Beattie, 15 years ago)
  • django/forms/fields.py

     
    2121from django.utils.formats import get_format
    2222
    2323from util import ErrorList, ValidationError
    24 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
     24from widgets import TextInput, PasswordInput, EmailInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
    2525
    2626__all__ = (
    2727    'Field', 'CharField', 'IntegerField',
     
    410410    r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE)  # domain
    411411
    412412class EmailField(RegexField):
     413    widget = EmailInput
    413414    default_error_messages = {
    414415        'invalid': _(u'Enter a valid e-mail address.'),
    415416    }
  • django/forms/widgets.py

     
    1616from urlparse import urljoin
    1717
    1818__all__ = (
    19     'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'PasswordInput',
     19    'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'PasswordInput', 'EmailInput',
    2020    'HiddenInput', 'MultipleHiddenInput',
    2121    'FileInput', 'DateInput', 'DateTimeInput', 'TimeInput', 'Textarea', 'CheckboxInput',
    2222    'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect',
     
    225225        if not self.render_value: value=None
    226226        return super(PasswordInput, self).render(name, value, attrs)
    227227
     228class EmailInput(Input):
     229    input_type = 'email'
     230
    228231class HiddenInput(Input):
    229232    input_type = 'hidden'
    230233    is_hidden = True
Back to Top