diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index 70f8292565..40086de7f7 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -1,7 +1,7 @@ +from allauth.account.decorators import secure_admin_login from django.conf import settings from django.contrib import admin from django.contrib.auth import admin as auth_admin -from django.contrib.auth.decorators import login_required from django.utils.translation import gettext_lazy as _ from .forms import UserAdminChangeForm @@ -11,7 +11,8 @@ if settings.DJANGO_ADMIN_FORCE_ALLAUTH: # Force the `admin` sign in process to go through the `django-allauth` workflow: # https://docs.allauth.org/en/latest/common/admin.html#admin - admin.site.login = login_required(admin.site.login) # type: ignore[method-assign] + admin.autodiscover() + admin.site.login = secure_admin_login(admin.site.login) # type: ignore[method-assign] @admin.register(User)