Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use get_user_model method to allow custom auth user models overrides #4

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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