Fixes: #19187 - Management command for fetching UN/LOCODE data and regenerating UN_LOCODE values #19316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #19187
This adds a management command,
refresh_un_locode.py
, which fetches the latest UN/LOCODE data and formats it into the appropriate ChoiceSet tuple to assign toUN_LOCODE
.This is still a draft because:
UN_LOCODE
values inun_locode.py
have not yet been updated;cp1252
, and that is how the script treats them; the vast majority of names imported from the Subdivisions file are displayed correctly, but some (particularly in Vietnamese and some others) appear to still be wrong. If I open the CSV files directly on my Mac all the values are interpreted and displayed correctly, so either MacOS is able to do better on-the-fly encoding detection thanchardet
or Python'scsv
module can do, or there is some yet unknown character encoding that can be used to read the files.