-
Notifications
You must be signed in to change notification settings - Fork 374
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
CustomCountryModel not working #165
Comments
Instead of moving the AlternativeName model above Place and making the reference a concrete one, what happens if you simply change the lazy reference to @python_2_unicode_compatible
class Place(models.Model):
name = models.CharField(max_length=200, db_index=True, verbose_name="ascii name")
- alt_names = models.ManyToManyField('AlternativeName')
+ alt_names = models.ManyToManyField('cities.AlternativeName')
objects = models.GeoManager()
Does that fix it? |
I tried this way already and I get other errors
But the app core is installed
|
Dang, I was hoping it would be an easy fix. If you make a PR with your changes I'll review it and merge it in. As for making sure this doesn't break in the future, since these issues were caught by Django's checks framework, I'm thinking I can just make an app with custom/swapped models and run Django's |
I did more tests, it seems my fix didn't work at all, when it worked I deleted all django-cities migrations and I created them with makemigrations, this way your solution also work, I'll do more tests when I have time, this is a feedback for you in case you have more knowledge about migration files from django-cities. Both fixes have the same error, so your fix is the right one.
|
Hello! I was hoping to use a custom city model to add a multi-polygon field (see #125) and ran into this problem.
I get the errors complaining that myapp (containing custom City model) is not installed (it is). @valentinolaru When you say “your fix is the right one”, I don’t understand what you refer to. |
Yeah these swappable models doesn't seem to work for me either, I get similar error to above when swapping out Country and Continent. |
After changing the lazy
As per the instructions I am defining the swappables like so: models.py
settings.py CITIES_CONTINENT_MODEL = 'coworkations.Continent'
CITIES_COUNTRY_MODEL = 'coworkations.Country' |
Try adding |
all this variants not work -- coding: utf-8 --Generated by Django 1.10 on 2017-07-31 16:44from future import unicode_literals from django.conf import settings class Migration(migrations.Migration):
more_data field exists in migration but not in db |
This may be because django-cities does not yet define an AppConfig. I'll try to fix that later this week and report back. |
Same when swapping City model. |
This still doesn't work, if anyone was wondering 🙃 |
I don't have a lot of free time anymore (new job), so I won't be able to get to this for awhile. Can somebody whip up a PR adding an AppConfig to see if that fixes the problem? |
Hi! Same problem here. Has anyone fixed it? |
see #203 |
Any news about this issue? |
I do not have as much time for this project as I once did. I have contacted the owner about transferring maintainership to somebody else, but as of this writing, he has not responded. @mhamzawey @rodrivel I would happily accept a pull request that fixed this. At this point, that's going to be the fastest way to get this fixed. |
I'm also getting the issue and by the sounds of it, this project is now becoming laid to rest. From what I could test it appears the migrations are somehow causing the issues above (as well as the fix in #208) |
@ro5k0 This project is not being "laid to rest". I believe @adamhaney is the new maintainer. I simply don't consistently have time to maintain this project anymore, so it was time for somebody else to maintain it. |
Sorry @blag I was just going on the massive text in the README that states
and the fact this issue has been open since 2017. Those two things often mean the software gets laid to rest from experience. I'm not trying to take anything away from the stoic, invested work you and your fellow collaborators have put in for free to help this project grow. I do in-fact thank you. Great news if @adamhaney is now coming on board as the new maintainer. As mentioned above I believe the ongoing issue is related to the migrations as others have mentioned. |
@leibowitz #203 : doesn't help me to start, commented at PR #203 |
It worked fine for me |
After following this fix i was getting another issue as follows: django.db.migrations.exceptions.CircularDependencyError: cities.0005_add_foreignkeys_to_postalcode, cities.0006_typify_alt_names_and_add_is_historic, cities.0007_add_currency_and_postal_code_fields_to_country_model, cities.0008_add_code_to_district, cities.0009_add_slug_fields_to_models, cities.0010_adjust_unique_attributes, cities.0011_auto_20180108_0706, cities.0012_alter_alternativename_id_alter_city_id_and_more, address.0001_initial, cities.0002_continent_models_and_foreign_keys, cities.0003_add_verbose_name_and_related_names, cities.0004_rename_languages_to_language_codes |
Checklist
master
branch of django-cities.Steps to reproduce
Fresh install, add CustomCountryModel as it is in the example from django-cities, run makemigrations.
Environment:
Python 3.5.2
Django==1.10.5
django-cities==0.5.0.3 ( installed from github, branch master )
Expected behavior
I think it should do the migration files :)
Actual behavior
For a quick fix I moved the AlternativeNames model above Place and removed the lazy reference of AlternativeName
Let me know if you need more details.
The text was updated successfully, but these errors were encountered: