equal
deleted
inserted
replaced
1 """ |
1 """ |
2 Slovak-specific form helpers |
2 Slovak-specific form helpers |
3 """ |
3 """ |
4 |
4 |
5 from django.newforms.fields import Select, RegexField |
5 from django.forms.fields import Select, RegexField |
6 from django.utils.translation import ugettext |
6 from django.utils.translation import ugettext_lazy as _ |
7 |
7 |
8 class SKRegionSelect(Select): |
8 class SKRegionSelect(Select): |
9 """ |
9 """ |
10 A select widget widget with list of Slovak regions as choices. |
10 A select widget widget with list of Slovak regions as choices. |
11 """ |
11 """ |
25 """ |
25 """ |
26 A form field that validates its input as Slovak postal code. |
26 A form field that validates its input as Slovak postal code. |
27 Valid form is XXXXX or XXX XX, where X represents integer. |
27 Valid form is XXXXX or XXX XX, where X represents integer. |
28 """ |
28 """ |
29 default_error_messages = { |
29 default_error_messages = { |
30 'invalid': ugettext(u'Enter a postal code in the format XXXXX or XXX XX.'), |
30 'invalid': _(u'Enter a postal code in the format XXXXX or XXX XX.'), |
31 } |
31 } |
32 |
32 |
33 def __init__(self, *args, **kwargs): |
33 def __init__(self, *args, **kwargs): |
34 super(SKPostalCodeField, self).__init__(r'^\d{5}$|^\d{3} \d{2}$', |
34 super(SKPostalCodeField, self).__init__(r'^\d{5}$|^\d{3} \d{2}$', |
35 max_length=None, min_length=None, *args, **kwargs) |
35 max_length=None, min_length=None, *args, **kwargs) |