webhelpers.constants
¶
Place names and other constants often used in web forms.
Countries¶
-
webhelpers.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 webhelpers.constants as constants from webhelpers.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¶
-
webhelpers.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.
-
webhelpers.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.
-
webhelpers.constants.
canada_provinces
()¶ List of Canadian provinces.
Return a list of
(abbreviation, name)
tuples for all Canadian provinces and territories, sorted by name.
-
webhelpers.constants.
uk_counties
()¶ Return a list of UK county names.
Deprecations¶
The timezone helpers were removed in WebHelpers 0.6. Install the PyTZ package if you need them.