UKPostcodeField made more forgiving of input format
|Reported by:||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
The UKPostcodeField in django.contrib.localflavor.uk does a good job of checking a UK postcode is valid. However, it requires the letters to be uppercase and a space between the two parts. I think that's a bit too strict.
Here is a version that is more forgiving. It uppercases the string and inserts the space in the correct place before validation.
Patch and tests attached.
Change History (5)
comment:1 Changed 9 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Ready for checkin|
comment:2 Changed 9 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Ready for checkin → Accepted|