omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Unhandled pending operations with model #1003

Closed darkwizz closed 7 years ago

darkwizz commented 8 years ago

Good day, I have two django apps on nginx server with same class names. These two apps use the one PSA library. When I only create a database for the second app and apply all migrations loaded from remote repo, all is fine and migrations are applied. The next time when I run makemigrations or migrate, then get the next message:

unhandled pending operations for model: (referred to by fields: default.UserSocialAuth.user)

And the problem is that I try to use makemigrations to second app, but app label in is from the first one.

How can I handle this?

Thank you

itbabu commented 8 years ago

I've the same error: Here my traceback

Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 186, in handle
    changes = autodetector.changes(graph=executor.loader.graph)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/db/migrations/autodetector.py", line 46, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/db/migrations/autodetector.py", line 131, in _detect_changes
    self.old_apps = self.from_state.concrete_apps
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/db/migrations/state.py", line 166, in concrete_apps
    self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True)
  File "/opt/web/env/FOO/lib/python3.5/site-packages/django/db/migrations/state.py", line 235, in __init__
    raise ValueError(self._pending_models_error(pending_models))
ValueError: Unhandled pending operations for models:
  default.usersocialauth (referred to by fields: profiles.FacebookProfile.user_social_auth, profiles.GoogleProfile.user_social_auth)
omab commented 7 years ago

Closing, please reopen in social-app-django if still relevant.