[Python-modules-commits] [python-social-auth] 65/131: django migration should respect SOCIAL_AUTH_USER_MODEL setting

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:17:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.20
in repository python-social-auth.

commit d9b7b5f029f31bf6c037839483d099fd5ef34660
Author: Max Arnold <arnold.maxim at gmail.com>
Date:   Fri Jun 17 11:26:00 2016 +0700

    django migration should respect SOCIAL_AUTH_USER_MODEL setting
---
 .../apps/django_app/default/migrations/0002_add_related_name.py   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/social/apps/django_app/default/migrations/0002_add_related_name.py b/social/apps/django_app/default/migrations/0002_add_related_name.py
index 8e39f15..848a64a 100644
--- a/social/apps/django_app/default/migrations/0002_add_related_name.py
+++ b/social/apps/django_app/default/migrations/0002_add_related_name.py
@@ -4,6 +4,12 @@ from __future__ import unicode_literals
 from django.db import models, migrations
 from django.conf import settings
 
+from social.utils import setting_name
+
+USER_MODEL = getattr(settings, setting_name('USER_MODEL'), None) or \
+             getattr(settings, 'AUTH_USER_MODEL', None) or \
+             'auth.User'
+
 
 class Migration(migrations.Migration):
 
@@ -15,6 +21,6 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='usersocialauth',
             name='user',
-            field=models.ForeignKey(related_name='social_auth', to=settings.AUTH_USER_MODEL)
+            field=models.ForeignKey(related_name='social_auth', to=USER_MODEL)
         ),
     ]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list