From 2a3a56f3c2ae5e2d2a3e84724a9558b97f172155 Mon Sep 17 00:00:00 2001 From: Fernando Aramendi Date: Mon, 9 Jan 2023 12:36:06 -0300 Subject: [PATCH] use get_user_model method to allow custom auth user models overrides --- admin_two_factor/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin_two_factor/models.py b/admin_two_factor/models.py index 28fbb3f..aa4c620 100644 --- a/admin_two_factor/models.py +++ b/admin_two_factor/models.py @@ -5,7 +5,7 @@ import pyotp import qrcode from admin_two_factor import settings -from django.contrib.auth.models import User +from django.contrib.auth import get_user_model from django.core.cache import cache from django.core.exceptions import ValidationError from django.db import models @@ -13,7 +13,7 @@ class TwoFactorVerification(models.Model): - user = models.OneToOneField(User, on_delete=models.DO_NOTHING, related_name='two_step') + user = models.OneToOneField(get_user_model(), on_delete=models.DO_NOTHING, related_name='two_step') secret = models.CharField(_('secret key'), max_length=20, null=True, blank=True, unique=True, editable=False) code = models.CharField(_('code'), max_length=8, null=True, blank=True, help_text=_('You must enter the code here to active/deactivate two step verification.'))