coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
928 stars 372 forks source link

Make it possible to filter cities per country #27

Closed jpic closed 9 years ago

jpic commented 12 years ago

Wouldn't it be useful to be able to specify the countries that you want to import the cities for ? Maybe it's not necessary to import all cities of all countries in all projects.

twoolie commented 12 years ago

+1! This should be easier, but it is currently possible.

  1. ./manage.py cities --import=country
  2. Delete all the countries you don't need from the database.
  3. ./manage.py cities --import=city <-- This will skip cities that are in countries not in the Country table.
bashu commented 9 years ago

from https://github.com/coderholic/django-cities#configuration

...
# Alternatively you can specify multiple filenames to process:
CITIES_FILES = {
    'city': {
       'filenames': ["US.zip", "GB.zip", ]
       'urls':     ['http://download.geonames.org/export/dump/'+'{filename}']
    },
}
...