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

django migration should respect SOCIAL_AUTH_USER_MODEL setting #936

Closed max-arnold closed 8 years ago

max-arnold commented 8 years ago

We use stock auth.User model for administrators (without social auth) and custom UserAccount model for other types of users with enabled social auth. So we have SOCIAL_AUTH_USER_MODEL = 'customauth.UserAccount'.

The patch fixes the following failure:

./manage.py migrate --fake-initial

django.db.utils.IntegrityError: insert or update on table "social_auth_usersocialauth" violates foreign key constraint "social_auth_usersocialauth_user_id_17d28448_fk_auth_user_id"
DETAIL:  Key (user_id)=(225873) is not present in table "auth_user".
max-arnold commented 8 years ago

Do you have any objections against this patch? To me the fix looks obvious (bundled south migrations have something similar: https://github.com/omab/python-social-auth/blob/master/social/apps/django_app/default/south_migrations/__init__.py)

omab commented 8 years ago

Thanks!