From 2f1cdafce65f22fad3e8eb3e12c4f3e85e68ad62 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:07:43 +0200 Subject: [PATCH 1/6] [#4009] Remove forward annotations --- .../submissions/models/submission.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/openforms/submissions/models/submission.py b/src/openforms/submissions/models/submission.py index 76ebf0ddae..476d0881b5 100644 --- a/src/openforms/submissions/models/submission.py +++ b/src/openforms/submissions/models/submission.py @@ -52,7 +52,7 @@ @dataclass class SubmissionState: form_steps: list[FormStep] - submission_steps: list["SubmissionStep"] + submission_steps: list[SubmissionStep] def _get_step_offset(self): completed_steps = sorted( @@ -66,7 +66,7 @@ def _get_step_offset(self): ) return offset - def get_last_completed_step(self) -> "SubmissionStep" | None: + def get_last_completed_step(self) -> SubmissionStep | None: """ Determine the last step that was filled out. @@ -86,7 +86,7 @@ def get_last_completed_step(self) -> "SubmissionStep" | None: ) return next(candidates, None) - def get_submission_step(self, form_step_uuid: str) -> "SubmissionStep" | None: + def get_submission_step(self, form_step_uuid: str) -> SubmissionStep | None: return next( ( step @@ -96,7 +96,7 @@ def get_submission_step(self, form_step_uuid: str) -> "SubmissionStep" | None: None, ) - def resolve_step(self, form_step_uuid: str) -> "SubmissionStep": + def resolve_step(self, form_step_uuid: str) -> SubmissionStep: return self.get_submission_step(form_step_uuid=form_step_uuid) @@ -467,7 +467,7 @@ def remove_sensitive_data(self): @elasticapm.capture_span(span_type="app.data.loading") def load_submission_value_variables_state( self, refresh: bool = False - ) -> "SubmissionValueVariablesState": + ) -> SubmissionValueVariablesState: if hasattr(self, "_variables_state") and not refresh: return self._variables_state @@ -593,12 +593,12 @@ def render_summary_page(self) -> list[JSONObject]: return summary_data @property - def steps(self) -> list["SubmissionStep"]: + def steps(self) -> list[SubmissionStep]: # fetch the existing DB records for submitted form steps submission_state = self.load_execution_state() return submission_state.submission_steps - def get_last_completed_step(self) -> "SubmissionStep" | None: + def get_last_completed_step(self) -> SubmissionStep | None: """ Determine which is the next step for the current submission. """ @@ -620,7 +620,6 @@ def get_ordered_data_with_component_type(self) -> OrderedDict: component, value, ) - return ordered_data def get_merged_appointment_data(self) -> dict[str, dict[str, str | dict]]: @@ -668,16 +667,16 @@ def get_co_signer(self) -> str: logger.warning("Incomplete co-sign data for submission %s", self.uuid) return co_signer - def get_attachments(self) -> "SubmissionFileAttachmentQuerySet": + def get_attachments(self) -> SubmissionFileAttachmentQuerySet: from .submission_files import SubmissionFileAttachment return SubmissionFileAttachment.objects.for_submission(self) @property - def attachments(self) -> "SubmissionFileAttachmentQuerySet": + def attachments(self) -> SubmissionFileAttachmentQuerySet: return self.get_attachments() - def get_merged_attachments(self) -> Mapping[str, list["SubmissionFileAttachment"]]: + def get_merged_attachments(self) -> Mapping[str, list[SubmissionFileAttachment]]: if not hasattr(self, "_merged_attachments"): self._merged_attachments = self.get_attachments().as_form_dict() return self._merged_attachments From 17b1462f9976788c23d1e4ad831fe61b97ff61bf Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:23:40 +0200 Subject: [PATCH 2/6] [#4009] Remove merged data from admin form --- src/openforms/submissions/admin.py | 1 - .../submissions/submission/change_form.html | 20 ------------------- 2 files changed, 21 deletions(-) diff --git a/src/openforms/submissions/admin.py b/src/openforms/submissions/admin.py index edb9a0fff8..9618fa8855 100644 --- a/src/openforms/submissions/admin.py +++ b/src/openforms/submissions/admin.py @@ -269,7 +269,6 @@ def change_view(self, request, object_id, form_url="", extra_context=None): raise Http404(f"No {self.model._meta.object_name} matches the given query.") submission_details_view_admin(submission, request.user) extra_context = { - "data": submission.get_ordered_data_with_component_type(), "attachments": submission.get_merged_attachments(), "image_components": IMAGE_COMPONENTS, } diff --git a/src/openforms/submissions/templates/admin/submissions/submission/change_form.html b/src/openforms/submissions/templates/admin/submissions/submission/change_form.html index 57a6156948..e5cbaa922c 100644 --- a/src/openforms/submissions/templates/admin/submissions/submission/change_form.html +++ b/src/openforms/submissions/templates/admin/submissions/submission/change_form.html @@ -3,26 +3,6 @@ {% block after_field_sets %}