Ticket #12488: email_url_inputs.diff
File email_url_inputs.diff, 2.3 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, URLInput, 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 } … … 525 526 r'(?:/?|/\S+)$', re.IGNORECASE) 526 527 527 528 class URLField(RegexField): 529 widget = URLInput 528 530 default_error_messages = { 529 531 'invalid': _(u'Enter a valid URL.'), 530 532 'invalid_link': _(u'This URL appears to be a broken link.'), -
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', 'URLInput', 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 231 class URLInput(Input): 232 input_type = 'url' 233 228 234 class HiddenInput(Input): 229 235 input_type = 'hidden' 230 236 is_hidden = True