Ticket #12488: email_input.diff
File email_input.diff, 1.9 KB (added by , 15 years ago) |
---|
-
django/forms/fields.py
21 21 from django.utils.formats import get_format 22 22 23 23 from util import ErrorList, ValidationError 24 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget24 from widgets import TextInput, PasswordInput, EmailInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget 25 25 26 26 __all__ = ( 27 27 'Field', 'CharField', 'IntegerField', … … 410 410 r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain 411 411 412 412 class EmailField(RegexField): 413 widget = EmailInput 413 414 default_error_messages = { 414 415 'invalid': _(u'Enter a valid e-mail address.'), 415 416 } -
django/forms/widgets.py
16 16 from urlparse import urljoin 17 17 18 18 __all__ = ( 19 'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'PasswordInput', 19 'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'PasswordInput', 'EmailInput', 20 20 'HiddenInput', 'MultipleHiddenInput', 21 21 'FileInput', 'DateInput', 'DateTimeInput', 'TimeInput', 'Textarea', 'CheckboxInput', 22 22 'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect', … … 225 225 if not self.render_value: value=None 226 226 return super(PasswordInput, self).render(name, value, attrs) 227 227 228 class EmailInput(Input): 229 input_type = 'email' 230 228 231 class HiddenInput(Input): 229 232 input_type = 'hidden' 230 233 is_hidden = True