You need to setup a custom Country model.
Lets say you have an app 'mygeonames' with models.py:
import cities_light
from django.db import models
from cities_light.settings import ICountry
from cities_light.receivers import connect_default_signals
from cities_light.abstract_models import (AbstractCountry, AbstractRegion,
AbstractCity)
class Country(AbstractCountry):
capital = models.CharField(max_length=50)
connect_default_signals(Country)
class Region(AbstractRegion):
pass
connect_default_signals(Region)
class City(AbstractCity):
pass
connect_default_signals(City)
def process_country_import(sender, instance, items, **kwargs):
instance.capital = items[ICountry.capital]
cities_light.signals.country_items_post_import.connect(process_country_import)
Then in settings.py you should specify CITIES_LIGHT_APP_NAME = 'mygeonames'
, and put both apps 'cities_light' and 'mygeonames' to INSTALLED_APPS
After that you can migrate your DB and run ./manage.py cities_light
At the end you should get something like this:
In [1]: from mygeonames.models import Country
In [2]: cc = Country.objects.all()
In [3]: cc[0].capital
Out[3]: u'Paris'
But you might want to link with Cities table instead.
ICountry.capital
was the key I was looking for. And yes, I have to query for the City object with the capital name. – Prophylactic