[Python-modules-commits] [python-social-auth] 44/322: Added support for Django's User.EMAIL_FIELD.
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:12:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag v0.2.10
in repository python-social-auth.
commit 4d70b23eb603c1d9753a7982bd7b3bab7cf18d48
Author: Seán Hayes <gasphynx at gmail.com>
Date: Wed Nov 19 17:20:15 2014 -0500
Added support for Django's User.EMAIL_FIELD.
Useful for when an alternate User.EMAIL_FIELD is defined.
---
social/storage/django_orm.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/social/storage/django_orm.py b/social/storage/django_orm.py
index 7aaf982..8d89e4f 100644
--- a/social/storage/django_orm.py
+++ b/social/storage/django_orm.py
@@ -70,7 +70,11 @@ class DjangoUserMixin(UserMixin):
@classmethod
def get_users_by_email(cls, email):
- return cls.user_model().objects.filter(email__iexact=email)
+ user_model = cls.user_model()
+
+ email_field = getattr(user_model, 'EMAIL_FIELD', 'email')
+
+ return user_model.objects.filter(**{email_field+'__iexact': email})
@classmethod
def get_social_auth(cls, provider, uid):
--
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