Commit 6be5ff7b authored by Sharad Heft's avatar Sharad Heft
Browse files

Refactor getting of user model in auth backend.

parent 8847bdc6
......@@ -5,15 +5,12 @@ from django.conf import settings
from django.db import transaction
UserModel = get_user_model()
class TESTOAuth2Backend(ModelBackend):
def authenticate(self, id=None, username=None, **profile):
if id is None or username is None:
return None
user, _ = UserModel.objects.get_or_create(
user, _ = get_user_model().objects.get_or_create(
......@@ -24,6 +21,8 @@ class TESTOAuth2Backend(ModelBackend):
return user
def get_user(self, user_id):
UserModel = get_user_model()
return UserModel.objects.get(pk=user_id)
except UserModel.DoesNotExist:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment