From 70408ab6fed8ef2370c204de52fd17a739e4d5be Mon Sep 17 00:00:00 2001 From: Tammo Feldmann <31222040+Tammo-Feldmann@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:56:28 -0800 Subject: [PATCH] Change historical detail view --- app/admin_ui/views/v2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/admin_ui/views/v2.py b/app/admin_ui/views/v2.py index 895971bd..8b95ee93 100644 --- a/app/admin_ui/views/v2.py +++ b/app/admin_ui/views/v2.py @@ -187,14 +187,17 @@ class HistoryDetailView(ModelObjectView): def get_model_form_content_type(self) -> ContentType: return Change.objects.get(uuid=self.kwargs[self.pk_url_kwarg]).content_type + def get_object(self): + return Change.objects.get(uuid=self.kwargs['draft_uuid']) + def get_context_data(self, **kwargs): return { **super().get_context_data(**kwargs), - "model_form": self._get_form(instance=kwargs.get("object"), disable_all=True), + "model_form": self._get_form(initial=kwargs.get("object").update, disable_all=True), "view_model": ( Change.objects.get(uuid=self.kwargs[self.pk_url_kwarg]).model_name.lower() ), - "object": Change.objects.get(uuid=self.kwargs[self.pk_url_kwarg]), + "object": kwargs.get("object"), "display_name": Change.objects.get(uuid=self.kwargs[self.pk_url_kwarg]).model_name, "canonical_uuid": self.kwargs[self.pk_url_kwarg], }