Monday, July 27, 2015

Django 1.8 migrations showing "AttributeError"

Hi,
   Problem: Empty migration doesn't show user friendly message.
   
   When i run "python manage.py migrate" with no new migrations to be applied it show me error message "AttributeError: '_Meta' object has no attribute 'model_name'" instead of showing user friendly message "no migration to apply".
   I have using python3.4.1, django 1.8.3

Steps to replicate: First run migrate command to apply all migrations, Next re-run same command again.
     
 Below is trackback for reference.
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  No migrations to apply.

Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 207, in handle
    changes = autodetector.changes(graph=executor.loader.graph)
  File "//lib/python3.4/site-packages/django/db/migrations/autodetector.py", line 43, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/lib/python3.4/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'

Did anyone face similar issue?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHX9ajQxyzCFR%3DFEtF3RZxyveQuUcn%3DDMgDLThmbPXkC14TQag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment