Opened 9 years ago

Closed 9 years ago

#5670 closed (fixed)

UKPostcodeField made more forgiving of input format

Reported by: scott@… Owned by: nobody
Component: contrib.localflavor Version: master
Severity: Keywords: uk postcode
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


The UKPostcodeField in 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.

Attachments (2)

ukpostcodefield.diff (3.7 KB) - added by scott@… 9 years ago.
Patch and tests
ukpostcodefield2.diff (3.8 KB) - added by scott@… 9 years ago.
New patch against trunk (includes tests)

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by scott@…

Patch and tests

comment:1 Changed 9 years ago by Simon G <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 9 years ago by jacob

  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

This patch no longer applies cleanly. Can you update it to apply against trunk?

Changed 9 years ago by scott@…

New patch against trunk (includes tests)

comment:3 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [6952]) Fixed #5670 -- Changed the validation of the UK postcode widget to allow for easier input. Normalisation still returns the same things as previously. Patch from scott@….

Note: See TracTickets for help on using tickets.
Back to Top