Ticket #5523: ukcountieslocalflavor-5523.diff
| File ukcountieslocalflavor-5523.diff, 1.3 kB (added by DavidReynolds, 1 year ago) |
|---|
-
a/django/contrib/localflavor/uk/forms.py
old new 2 2 UK-specific Form helpers 3 3 """ 4 4 5 from django.newforms.fields import RegexField 5 from django.newforms.fields import RegexField, Select 6 6 from django.utils.translation import ugettext 7 7 8 8 class UKPostcodeField(RegexField): … … 17 17 max_length=None, min_length=None, 18 18 error_message=ugettext(u'Enter a postcode. A space is required between the two postcode parts.'), 19 19 *args, **kwargs) 20 21 class UKCountySelect(Select): 22 """ 23 A Select widget that uses a list of UK Counties/Regions as its choices. 24 """ 25 def __init__(self, attrs=None): 26 from uk_regions import UK_REGION_CHOICES 27 super(UKCountySelect, self).__init__(attrs, choices=UK_REGION_CHOICES) 28 29 30 class UKNationSelect(Select): 31 """ 32 A Select widget that uses a list of UK Nations as its choices. 33 """ 34 def __init__(self, attrs=None): 35 from uk_regions import UK_NATIONS_CHOICES 36 super(UKNationSelect, self).__init__(attrs, choices=UK_NATIONS_CHOICES)
