Skip to content

Commit

Permalink
use get_user_model method to allow custom auth user models overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
fara committed Jan 9, 2023
1 parent 9f918e3 commit 2a3a56f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions admin_two_factor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
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
from django.utils.translation import gettext as _


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.'))
Expand Down

0 comments on commit 2a3a56f

Please sign in to comment.