Opened 9 years ago

Closed 9 years ago

#14937 closed (fixed)

US localflavor postal abbreviations

Reported by: James Bennett Owned by: nobody
Component: contrib.localflavor Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:


Building on #9022 and the ongoing fallout from #8425, we really should provide a way to represent all abbreviations recognized by the US Postal Service without causing an international incident.

The attached patch does this by breaking down the choices into multiple fine-grained lists. It is backwards compatible in that its version of STATE_CHOICES contains all the choices present in the current STATE_CHOICES, but adds the following:

  • STATE_CHOICES now also contains Armed Forces "state" abbreviations.
  • A new tuple, USPS_CHOICES, contains all recognized USPS abbreviations, including independent nations which receive postal service from the United States.
  • A new model field (USPostalCodeField) and form field (USPSSelect) are added, taking advantage of the new USPS_CHOICES tuple.
  • Individual choice tuples are provided for: the "lower 48" states plus DC; all 50 states plus DC; all US territories; all US armed forces "states"; independent nations serviced by USPS; and obsolete abbreviations formerly recognized by USPS (e.g., the Panama Canal Zone).

Attachments (2)

us_postal_codes.diff (15.3 KB) - added by James Bennett 9 years ago.
us_postal_codes_2.diff (15.3 KB) - added by James Bennett 9 years ago.
Correct a typo in original patch

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by James Bennett

Attachment: us_postal_codes.diff added

Changed 9 years ago by James Bennett

Attachment: us_postal_codes_2.diff added

Correct a typo in original patch

comment:1 Changed 9 years ago by James Bennett

Resolution: fixed
Status: newclosed

(In [15029]) Refactor the choices for localflavor's USStateField, and add new US postal code support. Fixes #14937 and #9022, refs #10308 and #8425.

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