Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading all countries data instead of selected ones and automatically translating cities name field value #276

Open
kumar-student opened this issue Nov 27, 2022 · 0 comments

Comments

@kumar-student
Copy link

I configured settings as bellow

# yourapp/models.py

from cities_light.abstract_models import (AbstractCity, AbstractRegion,
    AbstractCountry)
from cities_light.receivers import connect_default_signals


class Country(AbstractCountry):
    pass
connect_default_signals(Country)

class Region(AbstractRegion):
    pass
connect_default_signals(Region)


class City(AbstractCity):
    timezone = models.CharField(max_length=40)
connect_default_signals(City)
# Settings.py

INSTALLED_APPS = [
    .......
    'cities_light',
]
CITIES_LIGHT_APP_NAME = 'countries'
CITIES_LIGHT_TRANSLATION_LANGUAGES = ['en']
COUNTRIES_COUNTRY_MODEL = 'countries.Country'
COUNTRIES_CITY_MODEL = 'countries.City'
CITILES_LIGHT_INCLUDE_COUNTRIES = ['BR', 'IN', 'US']
CITIES_LIGHT_INCLUDE_CITY_TYPES = [
    'PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC',
    'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT',
]

Screenshot from 2022-11-27 19-08-43

when I run python manage.py cities_light it didn't respond 1st time and 2nd time loaded all data instead of selected countries and created cities record's field values in different language

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant