Opened 13 years ago
Closed 13 years ago
#17544 closed Bug (invalid)
PL localflavor field PLNIPfield allows improper values
Reported by: | Jerzy Ludwichowski | Owned by: | nobody |
---|---|---|---|
Component: | contrib.localflavor | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
One such value is "1112025170":
>>> from django.contrib.localflavor.pl import forms >>> form = forms.PLNIPField() >>> bool(form.has_valid_checksum("1112025170")) True
whereas it is not a valid NIP (tax id number) as the checksum for it is equal 10. All such numbers are not valid formally.
Attaching the simplest possible patch.
Attachments (2)
Change History (4)
by , 13 years ago
Attachment: | forms.patch added |
---|
comment:1 by , 13 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Thanks for reporting. Please could you improve your patch with a test? See changeset:17346 for tips to how the test should be written.
comment:2 by , 13 years ago
Has patch: | unset |
---|---|
Needs tests: | unset |
Resolution: | → invalid |
Status: | new → closed |
I am sorry. The validation is correct: NIP numbers with checksum = 10 are properly recognized as invalid. My example in the initial report has the checksum = 0 which is correct. Sorry for the noise. NB the prompt for a test case made me realize my error -- many thanks.
Patch for django/contrib/localflavor/pl/forms (#17544)