- Fixed chinese city name_ascii support
- Fixed support for regions without names
- to_search() now automatically called when filtering on
search_names
In 1.9.0, you had to query like::
City.objects.filter(search_names__icontains=to_search('Paris, Fra'))
In 1.9.1, passing the value through to_search() is automatic::
City.objects.filter(search_names__icontains='Paris, Fra')
Keep in mind that 'Paris, Fra' will be converted in 'parisfra',
which is useable against search_names column.
2012-06-07 1.9.0 Added Regions/states
- Run migrations: added Region, for USA state support because for example
there is a city called "Greenville" in almost every state.
- Remove CityAutocompleteWidget, in favor of a google-maps-like
autocomplete channel, which you can use with the normal widget.
- Update your querysets using search_names__icontains=some_value to do
search_names__icontains=cities_light.models.to_ascii(some_value).
- Run: ./manage.py cities_light --noinsert to update data, set
search_names, alternate_names, region ...
- If filtering cities to import with city_items_pre_import, make a matching
signal reciever for region_items_pre_import new signal. For example::
COUNTRIES = ('FR', 'US', 'BE', 'GB', 'ES', 'PT', 'DE', 'NL')
def filter_city_import(sender, items, **kwargs):
if items[8] not in COUNTRIES:
raise cities_light.InvalidItems()
cities_light.signals.city_items_pre_import.connect(filter_city_import)
def filter_region_import(sender, items, **kwargs):
if items[0].split('.')[0] not in COUNTRIES:
raise cities_light.InvalidItems()
cities_light.signals.region_items_pre_import.connect(filter_region_import)
Also there is now a progress bar in the cities_light command.
Note that the cities_light command now has very performant implementation
of alternateNames parser, which opens possibilities:
- it parses postal codes, but doesn't do anything with them yet
- it parses the name of every country/region/city in any language, used
only for search_names in this version
For 2.0, we aim at:
- including cities_light.contrib.postal_codes,
- including po files with the translation for every country/region/city
name
Contributions are really welcome so please if you need any of these
features don't hesitate to implement and do pull requests !