constants – Useful constants (Geo-lists)

webhelpers.constants

Geographical and other constants often used in web forms.

The timezone functions have been removed. Install the PyTZ package if you need them.

webhelpers.constants.uk_counties()
Returns a list of UK county names based on data from http://www.gbet.com/AtoZ_counties/ Last updated on 2007-10-24.
webhelpers.constants.country_codes()

Return a list of all country names and their respective codes specified by the ISO in the format:

[
    ...
    ['GB', 'United Kingodom],
    ...
]

See here for more information: http://www.iso.org/iso/english_country_names_and_code_elements

Can be used like this:

h.select(
    "country", 
    option_tags=options_with_please_select(
        country_codes(),
        selected = 'GB',
        caption = 'Please choose a country'
    ),
)

Last updated on 2007-10-24.

webhelpers.constants.us_states()

USA states.

Return a list of (abbreviation, name) for all US states, sorted by name. Includes the District of Columbia.

From http://www.usps.com/ncsc/lookups/abbreviations.html Updated 2008-05-01

webhelpers.constants.us_territories()

USA postal abbreviations for territories, protectorates, and military.

From http://www.usps.com/ncsc/lookups/abbreviations.html Updated 2008-05-01

webhelpers.constants.canada_provinces()

Canadian provinces and abbreviations.

Return a list of (abbreviation, name) for all Canadian provinces and territories, sorted by name.

Transcribed from Wikipedia on 2008-05-01. http://en.wikipedia.org/wiki/Canadian_subnational_postal_abbreviations

See also http://en.wikipedia.org/wiki/Provinces_and_territories_of_Canada