webhelpers2.constants

Place names and other constants often used in web forms.

Countries

webhelpers2.constants.country_codes()

Return a list of all country names as tuples. The tuple value is the country’s 2-letter ISO code and its name; e.g., ("GB", "United Kingdom"). The countries are in name order.

Can be used like this:

import webhelpers2.constants as constants
from webhelpers2.html.tags import select
select("country", country_codes(),
    prompt="Please choose a country ...")

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

States & Provinces

webhelpers2.constants.us_states()

List of USA states.

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

webhelpers2.constants.us_territories()

USA postal abbreviations for territories, protectorates, and military.

The return value is a list of (abbreviation, name) tuples. The locations are sorted by name.

webhelpers2.constants.canada_provinces()

List of Canadian provinces.

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

webhelpers2.constants.uk_counties()

Return a list of UK county names.