]> git.0d.be Git - panikdb.git/commitdiff
use get_user_model to get User model
authorFrédéric Péters <fpeters@0d.be>
Sat, 22 May 2021 06:52:02 +0000 (08:52 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sat, 22 May 2021 06:52:02 +0000 (08:52 +0200)
panikdb/forms.py

index fb89ecf540f32f9e466c17b0f921b244adea99fd..b8b00a2ac929cc184245bd1c1f979a945dbfc71e 100644 (file)
@@ -1,8 +1,6 @@
 from django import forms
 import django.contrib.auth.forms
-from django.contrib.auth import authenticate
-
-from panikdb.aa.models import User
+from django.contrib.auth import authenticate, get_user_model
 
 
 class AuthenticationForm(django.contrib.auth.forms.AuthenticationForm):
@@ -13,7 +11,7 @@ class AuthenticationForm(django.contrib.auth.forms.AuthenticationForm):
         if username and password:
             user = None
             if '@' in username:
-                user = User.objects.filter(email=username).first()
+                user = get_user_model().objects.filter(email=username).first()
                 if user:
                     self.user_cache = authenticate(username=user.username, password=password)
             else: