USSocialSecurityNumberField doesn't validate the same when entered without hypens
|Reported by:||Owned by:||nobody|
|Severity:||Normal||Keywords:||localflavor, ussocialsecuritynumberfield, localflavorsplit|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||yes|
In the us localflavor USSocialSecurityNumberField, if you enter an SSN without hyphens, the 'Woolworth' validations aren't run properly because they're explicity '078-05-1120' and '219-009-9999' instead of checking against the parts.
I refactored the field and created a patch that fixes it, plus added much better tests (in my opinion... added a test for each scenario).
Lastly, sometimes a user might NOT want to force the output to xxx-xx-xxxx. It might be useful to just leave it without hyphens. (in my case, need to pass ssn to a credit report service and will never need the dashes and I don't want to strip them out every time.) So, I added an optional keyword argument 'no_hyphen' to the ssn field which just forces the output to not have hyphens.
Please include or give feedback on the patch.
Change History (6)
comment:1 Changed 5 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|