Simple django app

Settings

Settings for this application. The most important is TRANSLATION_LANGUAGES because it’s probably project specific.

TRANSLATION_LANGUAGES
List of language codes. It is used to generate the alternate_names property of cities_light models. You want to keep it as small as possible. By default, it includes the most popular languages according to wikipedia, which use a rather ascii-compatible alphabet. It also contains ‘abbr’ which stands for ‘abbreviation’, you might want to include this one as well.

See:

COUNTRY_SOURCES
A list of urls to download country info from. Default is countryInfo.txt from geonames download server. Overridable in settings.CITIES_LIGHT_COUNTRY_SOURCES.
REGION_SOURCES
A list of urls to download region info from. Default is admin1CodesASCII.txt from geonames download server. Overridable in settings.CITIES_LIGHT_REGION_SOURCES
CITY_SOURCES
A list of urls to download city info from. Default is cities15000.zip from geonames download server. Overridable in settings.CITIES_LIGHT_CITY_SOURCES
TRANSLATION_SOURCES
A list of urls to download alternate names info from. Default is alternateNames.zip from geonames download server. Overridable in settings.CITIES_LIGHT_TRANSLATION_SOURCES
SOURCES
A list with all sources.
DATA_DIR
Absolute path to download and extract data into. Default is cities_light/data. Overridable in settings.CITIES_LIGHT_DATA_DIR
INDEX_SEARCH_NAMES
If your database engine for cities_light supports indexing TextFields (ie. it is not MySQL), then this should be set to True. You might have to override this setting if using several databases for your project.

Models

See source for details.

class cities_light.models.Country(*args, **kwargs)[source]

Country model.

class cities_light.models.Region(*args, **kwargs)[source]

Region/State model.

class cities_light.models.City(*args, **kwargs)[source]

City model.

Convert a string value into a string that is usable against City.search_names.

For example, ‘Paris Texas’ would become ‘paristexas’.

Admin

See source for details.

class cities_light.admin.CityAdmin(model, admin_site)[source]

ModelAdmin for City.

form

alias of CityForm

class cities_light.admin.CountryAdmin(model, admin_site)[source]

ModelAdmin for Country.

form

alias of CountryForm

class cities_light.admin.RegionAdmin(model, admin_site)[source]

ModelAdmin for Region.

form

alias of RegionForm