diff --git a/django/contrib/localflavor/pl/forms.py b/django/contrib/localflavor/pl/forms.py
index ffa9ec4..3e8d73f 100644
a
|
b
|
class PLNationalIDCardNumberField(RegexField):
|
122 | 122 | class PLNIPField(RegexField): |
123 | 123 | """ |
124 | 124 | A form field that validates as Polish Tax Number (NIP). |
125 | | Valid forms are: XXX-XXX-YY-YY or XX-XX-YYY-YYY. |
| 125 | Valid forms are: XXX-YYY-YY-YY, XXX-YY-YY-YYY or XXXYYYYYYY. |
126 | 126 | |
127 | 127 | Checksum algorithm based on documentation at |
128 | 128 | http://wipos.p.lodz.pl/zylla/ut/nip-rego.html |
129 | 129 | """ |
130 | 130 | default_error_messages = { |
131 | | 'invalid': _(u'Enter a tax number field (NIP) in the format XXX-XXX-XX-XX or XX-XX-XXX-XXX.'), |
| 131 | 'invalid': _(u'Enter a tax number field (NIP) in the format XXX-XXX-XX-XX, XXX-XX-XX-XXX or XXXXXXXXXX.'), |
132 | 132 | 'checksum': _(u'Wrong checksum for the Tax Number (NIP).'), |
133 | 133 | } |
134 | 134 | |
135 | 135 | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
136 | | super(PLNIPField, self).__init__(r'^\d{3}-\d{3}-\d{2}-\d{2}$|^\d{2}-\d{2}-\d{3}-\d{3}$', |
| 136 | super(PLNIPField, self).__init__(r'^\d{3}-\d{3}-\d{2}-\d{2}$|^\d{3}-\d{2}-\d{2}-\d{3}$|^\d{10}$', |
137 | 137 | max_length, min_length, *args, **kwargs) |
138 | 138 | |
139 | 139 | def clean(self,value): |
diff --git a/docs/ref/contrib/localflavor.txt b/docs/ref/contrib/localflavor.txt
index 4671906..1593598 100644
a
|
b
|
Poland (``pl``)
|
960 | 960 | |
961 | 961 | .. class:: pl.forms.PLNIPField |
962 | 962 | |
963 | | A form field that validates input as a Polish Tax Number (NIP). Valid |
964 | | formats are XXX-XXX-XX-XX or XX-XX-XXX-XXX. The checksum algorithm used |
| 963 | A form field that validates input as a Polish Tax Number (NIP). Valid formats |
| 964 | are XXX-XXX-XX-XX, XXX-XX-XX-XXX or XXXXXXXXXX. The checksum algorithm used |
965 | 965 | for NIPs is documented at http://wipos.p.lodz.pl/zylla/ut/nip-rego.html. |
966 | 966 | |
967 | 967 | .. class:: pl.forms.PLCountySelect |
diff --git a/tests/regressiontests/localflavor/pl/tests.py b/tests/regressiontests/localflavor/pl/tests.py
index 8c7af38..52154f8 100644
a
|
b
|
class PLLocalFlavorTests(SimpleTestCase):
|
420 | 420 | self.assertFieldOutput(PLPostalCodeField, valid, invalid) |
421 | 421 | |
422 | 422 | def test_PLNIPField(self): |
423 | | error_format = [u'Enter a tax number field (NIP) in the format XXX-XXX-XX-XX or XX-XX-XXX-XXX.'] |
| 423 | error_format = [u'Enter a tax number field (NIP) in the format XXX-XXX-XX-XX, XXX-XX-XX-XXX or XXXXXXXXXX.'] |
424 | 424 | error_checksum = [u'Wrong checksum for the Tax Number (NIP).'] |
425 | 425 | valid = { |
426 | | '64-62-414-124': '6462414124', |
427 | 426 | '646-241-41-24': '6462414124', |
| 427 | '646-24-14-124': '6462414124', |
| 428 | '6462414124': '6462414124', |
428 | 429 | } |
429 | 430 | invalid = { |
430 | 431 | '43-343-234-323': error_format, |
| 432 | '64-62-414-124': error_format, |
431 | 433 | '646-241-41-23': error_checksum, |
432 | 434 | } |
433 | 435 | self.assertFieldOutput(PLNIPField, valid, invalid) |