coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
927 stars 371 forks source link

Python 3 and Django 1.8+ support, fix importing data, use tqdm progre… #110

Closed blag closed 8 years ago

blag commented 8 years ago

…ss bars, new language and locale models, and cleanup README.

New migrations are not reverse compatible.

Python 3 and Django 1.8+ are now supported.

Importing data from geonames has been fixed, and now has progress bars! Please test this out and create issues if it breaks. Django migrations have been added that automatically import data.

The postal codes model has been modified to contain both the string representation of the region, subregion, and district they are contained in, as well as having foreign keys to the relevant objects (if those objects exist in the database).

There are three new models: language family, language, and locale. The previous comma separated strings that held language data in the country and alternative name models have been converted to many-to-many relationships (through the locale model) and foreign keys to the language models, respectively.

In addition to the new language models, django-cities now imports data from the Wikipedia pages for ISO 639 languages and macrolanguages and from the geonames iso-languagecodes.txt file.

The README formatting has a few new sections and has been slightly tweaked and cleaned up.

Comments are welcome.

blag commented 8 years ago

I'll rework this to make it even with 'coderholic:master' (redo migrations to be reverse compatible with the existing Django migrations, etc.) but I figured I should get some feedback first.

coderholic commented 8 years ago

I love these changes, and think they're a great idea! Does an upgrade from 0.4 to 0.5 work with the provided code, or is further work needed for that?

blag commented 8 years ago

This PR needs more work, I've got more changes to models and import fixups cooking, I should be done with them soon.

I'll try to split this up into a few different PRs so they're easier to review, I'm thinking something like:

So let me know what you think of those.

blag commented 8 years ago

I have a few more changes to make:

Once I've created PRs for those changes I'll close this PR.

I tried to redo the language handling, but it grew too big to include in django-cities, so I created a new app (django-world-languages) and made it dependent on django-cities.

stantond commented 8 years ago

@blag looking forward to this. Any update on when we might see a 0.5?

blag commented 8 years ago

@stringsonfire I have everything but the per-country postal code validation written locally, but I've got a few other things prioritized before cleaning up and publishing these changes, and I'd like to write tests and get Travis-CI up and running before integrating them.

If you'd like to see what I've got so far I can push them to a different branch and let you play around with them.

stantond commented 8 years ago

@blag that's OK, I've got a few things to be doing beforehand. On a side note, I've been looking into Mapzen's Who's On First gazetteer, and it looks incredible. If you haven't had a dig, worth looking. I don't know if it's possible to expand django-cities using their data, but it would be awesome to use their stuff in a project.