-
Notifications
You must be signed in to change notification settings - Fork 317
Description
What version of Unfold are you using?
For example: 0.59.0 or main
What version of Django are you using?
For example: 5.1
What browser are you using?
For example: Google Chrome Version 136.0.7103.114 (Official Build) (64-bit)
Did you checked changelog/commit history, if the bug is not already fixed?
For example: Yes
Did you searched other issues, if the bug is not already fixed?
For example: Yes
Did you checked documentation?
For example: Yes. Docs are here: https://unfoldadmin.com/docs/
I’m trying to add a custom page for password reset using UnfoldAdminSite.get_urls().
Even though I extend unfold/base.html or admin/login.html, the page renders without any Unfold styles — just plain HTML.
Everything works fine for default admin pages or views included via ModelAdmin.get_urls() and UnfoldModelAdminViewMixin.
from unfold.sites import UnfoldAdminSite
from django.urls import path
from django.views.generic import TemplateView
class PasswordResetView(TemplateView):
template_name = "admin/password_reset_by_phone.html"
class CustomAdminSite(UnfoldAdminSite):
def get_urls(self) -> list[URLPattern]:
extra_urls = []
if hasattr(self, "extra_urls") and callable(self.extra_urls):
extra_urls = self.extra_urls()
urlpatterns = (
[
path("search/", self.admin_view(self.search), name="search"),
path(
"toggle-sidebar/",
self.admin_view(self.toggle_sidebar),
name="toggle_sidebar",
),
path('password-reset-phone/',
self.admin_view(PasswordResetView.as_view()),
name='admin_password_reset')
]
+ extra_urls
+ super().get_urls()
)
return urlpatterns
custom_admin_site = CustomAdminSite(name="custom_admin_site")
Template password_reset_by_phone.html
{% extends "admin/login.html" %}
{% block login_after %}
your content
{% endblock %}
Actual result:
The page renders with no Unfold styles (white background, no layout, etc.)
No reset password button visible
Is there a correct way to register custom pages in UnfoldAdminSite that keeps styling?
Thanks!

