From 59cd27002971d5214c3cdda6c4c66907756459f4 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 22 Mar 2017 20:06:21 +0100 Subject: [PATCH] Replace references to User model with get_user_model() Fixes bug where new users couldn't login No, I still don't understand what's going on here --- app/models/Committee.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/Committee.py b/app/models/Committee.py index 0c2875e..3886030 100644 --- a/app/models/Committee.py +++ b/app/models/Committee.py @@ -1,7 +1,7 @@ from django.db import models from django.conf import settings from django.utils.decorators import classonlymethod -from django.contrib.auth.models import User +from django.contrib.auth import get_user_model class Committee(models.Model): @@ -25,9 +25,9 @@ def update_committees(cls, committees): # Update members c_object.members.set( - [User.objects.get(username=m) for m in c_dict['members'] if User.objects.filter(username=m).exists()]) + [get_user_model().objects.get(username=m) for m in c_dict['members'] if get_user_model().objects.filter(username=m).exists()]) # Update chairman and email address - c_object.chairman = User.objects.filter(username=c_dict['chairman']).first() + c_object.chairman = get_user_model().objects.filter(username=c_dict['chairman']).first() c_object.email = c_dict['email'] c_object.save()