Django

Code

Ticket #5670 (closed: fixed)

Opened 1 year ago

Last modified 9 months ago

UKPostcodeField made more forgiving of input format

Reported by: scott@staplefish.com Assigned to: nobody
Milestone: Component: django.contrib.localflavor
Version: SVN Keywords: uk postcode
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

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

ukpostcodefield.diff (3.7 kB) - added by scott@staplefish.com on 10/03/07 08:20:43.
Patch and tests
ukpostcodefield2.diff (3.8 kB) - added by scott@staplefish.com on 12/04/07 15:06:03.
New patch against trunk (includes tests)

Change History

10/03/07 08:20:43 changed by scott@staplefish.com

  • attachment ukpostcodefield.diff added.

Patch and tests

12/02/07 18:55:38 changed by Simon G <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

12/04/07 14:01:54 changed by jacob

  • needs_better_patch set to 1.
  • stage changed from Ready for checkin to Accepted.

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

12/04/07 15:06:03 changed by scott@staplefish.com

  • attachment ukpostcodefield2.diff added.

New patch against trunk (includes tests)

12/18/07 22:43:47 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(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@staplefish.com.


Add/Change #5670 (UKPostcodeField made more forgiving of input format)




Change Properties
Action