Skip to content

Commit

Permalink
Replace references to User model with get_user_model()
Browse files Browse the repository at this point in the history
Fixes bug where new users couldn't login

No, I still don't understand what's going on here
  • Loading branch information
Compizfox committed Mar 22, 2017
1 parent dc099c6 commit 59cd270
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/Committee.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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()

0 comments on commit 59cd270

Please sign in to comment.