Opened 17 years ago

Closed 16 years ago

#5670 closed (fixed)

UKPostcodeField made more forgiving of input format

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

Description

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.

Attachments (2)

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

Download all attachments as: .zip

Change History (5)

by scott@…, 17 years ago

Attachment: ukpostcodefield.diff added

Patch and tests

comment:1 by Simon G <dev@…>, 16 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Jacob, 16 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

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

by scott@…, 16 years ago

Attachment: ukpostcodefield2.diff added

New patch against trunk (includes tests)

comment:3 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(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