2

I referenced a user model for python-social-auth to portfolio.User where portfolio is the name of my app, and have been encountering this error:

ValueError: Lookup failed for model referenced by field default.UserSocialAuth.user: portfolio.User

I have a similar problem to this question, but I still couldn't find an answer.

2

1 Answer 1

4

It is reported as bug with Django migrations. Fixed in the new version.

Django bug tracker ticket #22485

Django bug tracker ticket #22488

You need to fix migrations manually for now. Do it by editing dependencies inside the broken migration:

dependencies = [
    .
    .
    .
    ('portfolio', '0001_initial'),  # Add this line
]

You need to add reference to the missing model.

Try to migrate now, it should work.

2
  • Encountering this issue as well. Any thoughts on how to tell which migrations are the broken ones? Commented Oct 9, 2015 at 16:54
  • Unfortunately you need to look for it manually. Look for references to other models like FK or M2M and include the initial migration file into the dependencies if they're not there.
    – Mr.Coffee
    Commented Nov 4, 2015 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.