Opened 6 years ago

Closed 5 years ago

#13729 closed Bug (fixed)

UK localflavor mis-named/documentation bug.

Reported by: Matthew Schinckel Owned by: nobody
Component: contrib.localflavor Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:


The documentation for localflavor states that:

Inside that package, country- or culture-specific code is organized into subpackages, named using ISO 3166 country codes.

However, the ISO 3166 code for the United Kingdom is actually GB. Thus, anything that uses ISO 3166 codes to store countries (such as django-countries) will be unable to automatically get the correct localflavor information.

Since changing this would break existing code, perhaps there could be another gb module that just shadows the uk module.

For instance, in gb/, we might have:

from django.contrib.localflavor import uk
GBPostcodeField = uk.UKPostcodeField
GBCountySelect = uk.UKCountySelect
GBNationSelect = uk.UKNationSelect

This means that all is needed is this file, and any changes to the uk one will also apply to gb.

Attachments (2)

gb-localflavor.diff (604 bytes) - added by Matthew Schinckel 6 years ago.
13729-with-deprecation-path.diff (19.6 KB) - added by Claude Paroz 5 years ago.

Download all attachments as: .zip

Change History (12)

Changed 6 years ago by Matthew Schinckel

Attachment: gb-localflavor.diff added

comment:1 Changed 6 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Fraser Nevett

I raised this issue previously in #8323. As this ticket has been accepted and has a proposed patch, I closed the older ticket in favour of this one.

comment:3 Changed 6 years ago by Julien Phalip

Component: Contrib appsdjango.contrib.localflavor

comment:4 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:5 Changed 5 years ago by Claude Paroz

Easy pickings: unset
Patch needs improvement: set

We cannot leave the uk directory occupied by the gb content, because uk is the code for Ukrain. So we have to move files and follow a deprecation path in the current uk directory.

comment:6 Changed 5 years ago by Claude Paroz

Has patch: set
Patch needs improvement: unset

Changed 5 years ago by Claude Paroz

comment:7 Changed 5 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:8 Changed 5 years ago by anonymous

Just to correct comment 5, UA is the code for Ukraine. UK is "exceptionally reserved" for the United Kingdom (see

comment:9 Changed 5 years ago by Claude Paroz

Thanks for the correction, I mixed up uk ISO 639-1 for Ukrainian language and UA the ISO 3166 country code for Ukraine. It is not referenced in the patch, though.

comment:10 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

In [16147]:

Fixed #13729 -- Renamed UK localflavor to GB to correctly follow ISO 3166. Thanks, Claude Paroz.

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