diff --git a/django/contrib/localflavor/ar/forms.py b/django/contrib/localflavor/ar/forms.py
index 53721a1..57b5f8b 100644
a
|
b
|
class ARPostalCodeField(RegexField):
|
28 | 28 | 'invalid': _("Enter a postal code in the format NNNN or ANNNNAAA."), |
29 | 29 | } |
30 | 30 | |
31 | | def __init__(self, *args, **kwargs): |
| 31 | def __init__(self, max_length=8, min_length=4, *args, **kwargs): |
32 | 32 | super(ARPostalCodeField, self).__init__(r'^\d{4}$|^[A-HJ-NP-Za-hj-np-z]\d{4}\D{3}$', |
33 | | min_length=4, max_length=8, *args, **kwargs) |
| 33 | max_length, min_length, *args, **kwargs) |
34 | 34 | |
35 | 35 | def clean(self, value): |
36 | 36 | value = super(ARPostalCodeField, self).clean(value) |
… |
… |
class ARDNIField(CharField):
|
51 | 51 | 'max_digits': _("This field requires 7 or 8 digits."), |
52 | 52 | } |
53 | 53 | |
54 | | def __init__(self, *args, **kwargs): |
55 | | super(ARDNIField, self).__init__(max_length=10, min_length=7, *args, |
| 54 | def __init__(self, max_length=10, min_length=7, *args, **kwargs): |
| 55 | super(ARDNIField, self).__init__(max_length, min_length, *args, |
56 | 56 | **kwargs) |
57 | 57 | |
58 | 58 | def clean(self, value): |
… |
… |
class ARCUITField(RegexField):
|
81 | 81 | 'checksum': _("Invalid CUIT."), |
82 | 82 | } |
83 | 83 | |
84 | | def __init__(self, *args, **kwargs): |
| 84 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
85 | 85 | super(ARCUITField, self).__init__(r'^\d{2}-?\d{8}-?\d$', |
86 | | *args, **kwargs) |
| 86 | max_length, min_length, *args, **kwargs) |
87 | 87 | |
88 | 88 | def clean(self, value): |
89 | 89 | """ |
diff --git a/django/contrib/localflavor/pl/forms.py b/django/contrib/localflavor/pl/forms.py
index ef4a38b..8b4d2f4 100644
a
|
b
|
class PLPESELField(RegexField):
|
40 | 40 | 'checksum': _(u'Wrong checksum for the National Identification Number.'), |
41 | 41 | } |
42 | 42 | |
43 | | def __init__(self, *args, **kwargs): |
| 43 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
44 | 44 | super(PLPESELField, self).__init__(r'^\d{11}$', |
45 | | max_length=None, min_length=None, *args, **kwargs) |
| 45 | max_length, min_length, *args, **kwargs) |
46 | 46 | |
47 | 47 | def clean(self, value): |
48 | 48 | super(PLPESELField, self).clean(value) |
… |
… |
class PLNationalIDCardNumberField(RegexField):
|
77 | 77 | 'checksum': _(u'Wrong checksum for the National ID Card Number.'), |
78 | 78 | } |
79 | 79 | |
80 | | def __init__(self, *args, **kwargs): |
| 80 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
81 | 81 | super(PLNationalIDCardNumberField, self).__init__(r'^[A-Za-z]{3}\d{6}$', |
82 | | max_length=None, min_length=None, *args, **kwargs) |
| 82 | max_length, min_length, *args, **kwargs) |
83 | 83 | |
84 | 84 | def clean(self,value): |
85 | 85 | super(PLNationalIDCardNumberField, self).clean(value) |
… |
… |
class PLNIPField(RegexField):
|
129 | 129 | 'checksum': _(u'Wrong checksum for the Tax Number (NIP).'), |
130 | 130 | } |
131 | 131 | |
132 | | def __init__(self, *args, **kwargs): |
| 132 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
133 | 133 | super(PLNIPField, self).__init__(r'^\d{3}-\d{3}-\d{2}-\d{2}$|^\d{2}-\d{2}-\d{3}-\d{3}$', |
134 | | max_length=None, min_length=None, *args, **kwargs) |
| 134 | max_length, min_length, *args, **kwargs) |
135 | 135 | |
136 | 136 | def clean(self,value): |
137 | 137 | super(PLNIPField, self).clean(value) |
… |
… |
class PLREGONField(RegexField):
|
169 | 169 | 'checksum': _(u'Wrong checksum for the National Business Register Number (REGON).'), |
170 | 170 | } |
171 | 171 | |
172 | | def __init__(self, *args, **kwargs): |
| 172 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
173 | 173 | super(PLREGONField, self).__init__(r'^\d{9,14}$', |
174 | | max_length=None, min_length=None, *args, **kwargs) |
| 174 | max_length, min_length, *args, **kwargs) |
175 | 175 | |
176 | 176 | def clean(self,value): |
177 | 177 | super(PLREGONField, self).clean(value) |
… |
… |
class PLPostalCodeField(RegexField):
|
209 | 209 | 'invalid': _(u'Enter a postal code in the format XX-XXX.'), |
210 | 210 | } |
211 | 211 | |
212 | | def __init__(self, *args, **kwargs): |
| 212 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
213 | 213 | super(PLPostalCodeField, self).__init__(r'^\d{2}-\d{3}$', |
214 | | max_length=None, min_length=None, *args, **kwargs) |
| 214 | max_length, min_length, *args, **kwargs) |
215 | 215 | |
diff --git a/tests/regressiontests/forms/localflavor/ar.py b/tests/regressiontests/forms/localflavor/ar.py
index 9c67269..81668b3 100644
a
|
b
|
class ARLocalFlavorTests(LocalFlavorTestCase):
|
96 | 96 | '27-10345678-1': error_invalid, |
97 | 97 | u'27-10345678-1': error_invalid, |
98 | 98 | } |
99 | | self.assertFieldOutput(ARCUITField, valid, invalid) |
| 99 | self.assertFieldOutput(ARCUITField, valid, invalid, field_kwargs={'max_length':15, 'min_length':4}) |
diff --git a/tests/regressiontests/forms/localflavor/pl.py b/tests/regressiontests/forms/localflavor/pl.py
index 7225abe..4a0c4c9 100644
a
|
b
|
class PLLocalFlavorTests(LocalFlavorTestCase):
|
443 | 443 | '80': error_format, |
444 | 444 | '800716106AA': error_format, |
445 | 445 | } |
446 | | self.assertFieldOutput(PLPESELField, valid, invalid) |
| 446 | self.assertFieldOutput(PLPESELField, valid, invalid, field_kwargs={'max_length':11, 'min_length':4}) |
447 | 447 | |
448 | 448 | def test_PLNationalIDCardNumberField(self): |
449 | 449 | error_checksum = [u'Wrong checksum for the National ID Card Number.'] |