django-cities: CustomCountryModel not working
Checklist
- I have verified that I am using a GIS-enabled database, such as PostGIS or Spatialite.
- I have verified that that issue exists against the
masterbranch of django-cities. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
Fresh install, add CustomCountryModel as it is in the example from django-cities, run makemigrations.
INSTALLED_APPS = (
...
# I tried both order
'myapp',
'cities',
)
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
host:~#./manage.py makemigrations
SystemCheckError: System check identified some issues:
ERRORS:
<myapp>.CustomCountryModel.alt_names: (fields.E300) Field defines a relation with model 'AlternativeName', which is either not installed, or is abstract.
<myapp>.CustomCountryModel.alt_names: (fields.E307) The field <myapp>.CustomCountryModel.alt_names was declared with a lazy reference to '<myapp>.alternativename', but app '<myapp>' doesn't provide model 'alternativename'.
<myapp>.CustomCountryModel_alt_names.alternativename: (fields.E307) The field <myapp>.CustomCountryModel_alt_names.alternativename was declared with a lazy reference to '<myapp>.alternativename', but app '<myapp>' doesn't provide model 'alternativename'.
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.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 23
all this variants not work only variant with swapper in meta work without add to settings file CITIES_COUNTRY_MODEL = ‘geo.CustomCountryModel’ but there are no custom fields in model may be migrations made by django wrong
-- coding: utf-8 --
Generated by Django 1.10 on 2017-07-31 16:44
from future import unicode_literals
from django.conf import settings from django.db import migrations, models import django.db.models.deletion
class Migration(migrations.Migration):
more_data field exists in migration but not in db
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
checkmanagement command.