{"action":"created","issue":{"url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/89","labels_url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/89/comments","events_url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/89/events","html_url":"https://github.com/yourlabs/django-cities-light/issues/89","id":66390563,"number":89,"title":"exportdata / loaddata cycle doesn't work, possibly due to abstract models?","user":{"login":"duaneking","id":569341,"avatar_url":"https://avatars.githubusercontent.com/u/569341?v=3","gravatar_id":"","url":"https://api.github.com/users/duaneking","html_url":"https://github.com/duaneking","followers_url":"https://api.github.com/users/duaneking/followers","following_url":"https://api.github.com/users/duaneking/following{/other_user}","gists_url":"https://api.github.com/users/duaneking/gists{/gist_id}","starred_url":"https://api.github.com/users/duaneking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duaneking/subscriptions","organizations_url":"https://api.github.com/users/duaneking/orgs","repos_url":"https://api.github.com/users/duaneking/repos","events_url":"https://api.github.com/users/duaneking/events{/privacy}","received_events_url":"https://api.github.com/users/duaneking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-04-05T02:05:12Z","updated_at":"2015-12-13T15:25:10Z","closed_at":null,"body":"So I did something that seems to be pretty simple to me, but maybe I'm just doing it wrong since its been a  few versions since I worked with django, as what I think should be should be simple is failing in a way that suggests ether I have no idea what I am doing, or something is really wrong.\r\n\r\n## Problem\r\nOnce a manage.py cities_light has been done, I cant do a exportdata/loaddata cycle without the load cycle side failing to import anything due to a \"Country matching query does not exist.\" error.\r\n\r\n## Software Used\r\npython 2.7\r\ndjango 1.8 - yesterdays release of the new version\r\ndjango-cities-light - pulled this form pip yesterday\r\n\r\n\r\n## Repro steps\r\n(1). Create new empty dkango project.\r\n(2). Add models to the first app of the project.  Make sure to add Country, Region, and City models that literally only look like this for each of them:\r\n    \r\n    from cities_light.abstract_models import AbstractCountry\r\n    from cities_light.receivers import connect_default_signals\r\n    \r\n    \r\n    class Country(AbstractCountry):\r\n        pass\r\n    connect_default_signals(Country)\r\n    \r\n(3). Do the 2+ hour import of the city-light data.\r\n(4). Do an exportdata to export all the data in the db  a city_light.json file:\r\n    \r\n    python manage.py dumpdata --all > city_light.json\r\n    \r\n(5). Delete the sqlite db to trick django into thinking it needs to be created again.\r\n     \r\n     C:\\Users\\Duane\\Dropbox\\code\\github\\mouser>del db.sqlite3\r\n(6). I then do a full migration of my app so that it re-initalizes a new empty database with the correct schema that I had before.\r\n    \r\n    C:\\Users\\Duane\\Dropbox\\code\\github\\mouser>python manage.py migrate\r\n    C:\\Python27\\lib\\site-packages\\south\\modelsinspector.py:20: RemovedInDjango19Warning: django.contrib.contenttypes.generic is deprecated and will be removed in Django 1.9. Its contents have been moved to the fields, forms, and admin submodules of django.contrib.contenttypes.\r\n      from django.contrib.contenttypes import generic\r\n    \r\n    Operations to perform:\r\n      Synchronize unmigrated apps: staticfiles, messages\r\n      Apply all migrations: sessions, admin, auth, launcher, contenttypes, cities_light\r\n    Synchronizing apps without migrations:\r\n      Creating tables...\r\n        Running deferred SQL...\r\n      Installing custom SQL...\r\n    Running migrations:\r\n      Rendering model states... DONE\r\n      Applying contenttypes.0001_initial... OK\r\n      Applying auth.0001_initial... OK\r\n      Applying admin.0001_initial... OK\r\n      Applying contenttypes.0002_remove_content_type_name... OK\r\n      Applying auth.0002_alter_permission_name_max_length... OK\r\n      Applying auth.0003_alter_user_email_max_length... OK\r\n      Applying auth.0004_alter_user_username_opts... OK\r\n      Applying auth.0005_alter_user_last_login_null... OK\r\n      Applying auth.0006_require_contenttypes_0002... OK\r\n      Applying cities_light.0001_initial... OK\r\n      Applying cities_light.0002_city... OK\r\n      Applying cities_light.0003_auto_20141120_0342... OK\r\n      Applying cities_light.0004_auto_20150403_2001... OK\r\n      Applying launcher.0001_initial... OK\r\n      Applying launcher.0002_auto_20150403_2001... OK\r\n      Applying sessions.0001_initial... OK\r\n    \r\n(7). Now at this point the database should be  EXACTLY the same schema as it was when I did the data export. Exactly,just with no data. Right?\r\n\r\n(8). Now attempt to load the data from the saved city_light.json file into the database with the hope of never having to do another 2 hour long import of just city data again:\r\n    \r\n    C:\\Users\\Duane\\Dropbox\\code\\github\\mouser>python manage.py loaddata -v 3 city_light.json\r\n    C:\\Python27\\lib\\site-packages\\south\\modelsinspector.py:20: RemovedInDjango19Warning: django.contrib.contenttypes.generic is deprecated and will be removed in Django 1.9. Its contents have been moved to the fields, forms, and admin submodules of django.contrib.contenttypes.\r\n      from django.contrib.contenttypes import generic\r\n    \r\n    Loading 'city_light' fixtures...\r\n    Checking 'C:\\Users\\Duane\\Dropbox\\code\\github\\mouser\\launcher\\fixtures' for fixtures...\r\n    No fixture 'city_light' in 'C:\\Users\\Duane\\Dropbox\\code\\github\\mouser\\launcher\\fixtures'.\r\n    Checking 'C:\\Users\\Duane\\Dropbox\\code\\github\\mouser' for fixtures...\r\n    Installing json fixture 'city_light' from 'C:\\Users\\Duane\\Dropbox\\code\\github\\mouser'.\r\n    Traceback (most recent call last):\r\n      File \"manage.py\", line 12, in <module>\r\n        execute_from_command_line(sys.argv)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\__init__.py\", line 338, in execute_from_command_line\r\n            utility.execute()\r\n          File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\__init__.py\", line 330, in execute\r\n            self.fetch_command(subcommand).run_from_argv(self.argv)\r\n          File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\base.py\", line 390, in run_from_argv\r\n            self.execute(*args, **cmd_options)\r\n          File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\base.py\", line 441, in execute\r\n        output = self.handle(*args, **options)\r\n          File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\commands\\loaddata.py\", line 60, in handle\r\n            self.loaddata(fixture_labels)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\commands\\loaddata.py\", line 90, in loaddata\r\n        self.load_label(fixture_label)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\core\\management\\commands\\loaddata.py\", line 147, in load_label\r\n        obj.save(using=self.using)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\core\\serializers\\base.py\", line 173, in save\r\n        models.Model.save_base(self.object, using=using, raw=True)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\db\\models\\base.py\", line 734, in save_base\r\n        update_fields=update_fields)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\dispatch\\dispatcher.py\", line 201, in send\r\n        response = receiver(signal=self, sender=sender, **named)\r\n      File \"C:\\Python27\\lib\\site-packages\\cities_light\\receivers.py\", line 28, in set_display_name\r\n        instance.display_name = instance.get_display_name()\r\n      File \"C:\\Python27\\lib\\site-packages\\cities_light\\abstract_models.py\", line 114, in get_display_name    \r\n        return '%s, %s' % (self.name, self.country.name)\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\db\\models\\fields\\related.py\", line 602, in __get__\r\n        rel_obj = qs.get()\r\n      File \"C:\\Python27\\lib\\site-packages\\django\\db\\models\\query.py\", line 334, in get\r\n        self.model._meta.object_name\r\n    launcher.models.country.DoesNotExist: Problem installing fixture     'C:\\Users\\Duane\\Dropbox\\code\\github\\mouser\\city_light.json': Country matching query does not exist.\r\n\r\nAs you can see it seems to be failing to detect the models after loading the abstract ones.\r\n\r\nI'm totally blocked, and I have no idea what to do.  I have done everything according to the docs that I am aware of, and I expect to be able to export/import data at will, that does not work in my experience so far. \r\n\r\n## What I Am trying to do\r\nI want my app to be initialized from migrations, as that is the new django way and I want to embrace the future.  I don't want to have to download a large file form the internet and suffer though a huge deployment every time I deploy; I want to do it at most once, then have all the data in a django migration i just apply and am done with, that I can also check into our source control (git, in this case).  That is what I am trying to do\r\n"},"comment":{"url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/comments/164267862","html_url":"https://github.com/yourlabs/django-cities-light/issues/89#issuecomment-164267862","issue_url":"https://api.github.com/repos/yourlabs/django-cities-light/issues/89","id":164267862,"user":{"login":"jpic","id":94636,"avatar_url":"https://avatars.githubusercontent.com/u/94636?v=3","gravatar_id":"","url":"https://api.github.com/users/jpic","html_url":"https://github.com/jpic","followers_url":"https://api.github.com/users/jpic/followers","following_url":"https://api.github.com/users/jpic/following{/other_user}","gists_url":"https://api.github.com/users/jpic/gists{/gist_id}","starred_url":"https://api.github.com/users/jpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpic/subscriptions","organizations_url":"https://api.github.com/users/jpic/orgs","repos_url":"https://api.github.com/users/jpic/repos","events_url":"https://api.github.com/users/jpic/events{/privacy}","received_events_url":"https://api.github.com/users/jpic/received_events","type":"User","site_admin":false},"created_at":"2015-12-13T15:25:10Z","updated_at":"2015-12-13T15:25:10Z","body":"Could you maybe reproduce your issue in a minimal test project ?\r\n\r\nhttp://docs.yourlabs.org/en/latest/guidelines.html#yourlabs-community-guidelines\r\n\r\nThanks !"}}