From 1d62780ebbbcb869e95a0a45c0f4b997a39c8587 Mon Sep 17 00:00:00 2001 From: TarunvirBains <61893384+TarunvirBains@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:22:35 -0700 Subject: [PATCH] Update parentadmin.py fix parent admin form not behaving like an admin form (eg log out button context missing) --- polymorphic/admin/parentadmin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polymorphic/admin/parentadmin.py b/polymorphic/admin/parentadmin.py index d021522d..f4ee9d44 100644 --- a/polymorphic/admin/parentadmin.py +++ b/polymorphic/admin/parentadmin.py @@ -344,6 +344,7 @@ def render_add_type_form(self, request, context, form_url=""): "opts": opts, "add": True, "save_on_top": self.save_on_top, + **self.admin_site.each_context(request), } ) @@ -355,7 +356,7 @@ def render_add_type_form(self, request, context, form_url=""): ] request.current_app = self.admin_site.name - return TemplateResponse(request, templates, context) + return self.admin_site.admin_view(TemplateResponse)(request, templates, context) @property def change_list_template(self):