djangonauts / django-hstore

PostgreSQL HStore support for Django.
http://django-hstore.readthedocs.io/
Other
517 stars 142 forks source link

AttributeError when running 'makemigrations' on Django 1.8 #117

Closed bijanvakili closed 9 years ago

bijanvakili commented 9 years ago

I found this while doing some initial testing with Django 1.8 using latest code (commit 1376a667d9a2baa0e383024c8dbaee59e924bade) after waiting for issue #105 to be closed.

When running python manage.py makemigrations on an containing an hstore.DictionaryField in schema mode schema I get the following error:

Traceback (most recent call last):
  File "manage.py", line 25, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 125, in handle
    migration_name=self.migration_name,
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 43, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/Users/bvakili/.virtualenvs/django-upgrade/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 170, in _detect_changes
    old_field.rel.through._meta.model_name,
AttributeError: '_Meta' object has no attribute 'model_name'

No changes were made to my model. The virtual field in question has these specs:

{
       'name:' 'my_field',
        'class': 'TextField',
        'kwargs': {'blank': True, }
}
bijanvakili commented 9 years ago

@nemesisdesign @aidanlister This is the only issue I was able to find since your fix for Django 1.8. Everything else seems to be working normally for me.

Others have discussed this same bug here.

nemesifier commented 9 years ago

Looks like something here: https://github.com/djangonauts/django-hstore/blob/master/django_hstore/virtual.py#L91

nemesifier commented 9 years ago

Closed by https://github.com/djangonauts/django-hstore/commit/1e8e48619f0507d0e5dd25bb93559795880b7e20