forked from Axion/django-cities
-
Notifications
You must be signed in to change notification settings - Fork 0
Countries and cities of the world for Django projects
License
zanaticul/django-cities
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
django-cities - Place models and data for Django apps ===================================================== This project includes country, region, city, and district models and is prepopulated with data from GeoNames. The GeoNames import script is also included if you'd like to re-import the data yourself, or change the way in which it gets cleaned up. Includes 234 counties, 2,610 regions, 97,949 cities and 606 districts For more information and examples see https://www.coderholic.com/django-cities-countries-regions-cities-and-districts-for-django/ Examples: ========= Finding all London boroughs: >>> london = City.objects.filter(country__name='United Kingdom').get(name='London') >>> boroughs = District.objects.filter(city=london) Nearest city to a given lat,lon: >>> City.objects.nearest_to(51, 1) <City: Dymchurch, Kent, United Kingdom> 5 Nearest cities to London: >>> london = City.objects.filter(country__name='United Kingdom').get(name='London') >>> nearest = City.objects.distance(london.location).exclude(id=london.id).order_by('distance')[:5]
About
Countries and cities of the world for Django projects
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published