From ce589fa8eb82d5307d4c1db1d9febdf13bb41496 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Wed, 3 Apr 2024 09:42:53 +0200 Subject: [PATCH 1/3] :sparkles: [#4005] Add search on submission UUID and public reference --- src/openforms/submissions/admin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openforms/submissions/admin.py b/src/openforms/submissions/admin.py index edb9a0fff8..becaa88685 100644 --- a/src/openforms/submissions/admin.py +++ b/src/openforms/submissions/admin.py @@ -348,7 +348,11 @@ def retry_processing_submissions(self, request, queryset): class SubmissionReportAdmin(PrivateMediaMixin, admin.ModelAdmin): list_display = ("title",) list_filter = ("title",) - search_fields = ("title",) + search_fields = ( + "title", + "submission__uuid", + "submission__public_registration_reference", + ) raw_id_fields = ("submission",) private_media_fields = ("content",) From 08b0a3e2a4c2f12cb05ea099e100177e9df7b67b Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Wed, 3 Apr 2024 10:06:15 +0200 Subject: [PATCH 2/3] :sparkles: [#4005] Update title of submission report --- src/openforms/submissions/tasks/pdf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openforms/submissions/tasks/pdf.py b/src/openforms/submissions/tasks/pdf.py index 5442730f55..d5feb7d06e 100644 --- a/src/openforms/submissions/tasks/pdf.py +++ b/src/openforms/submissions/tasks/pdf.py @@ -23,7 +23,11 @@ def generate_submission_report(task, submission_id: int) -> None: submission_report = submission.report except SubmissionReport.DoesNotExist: submission_report = SubmissionReport.objects.create( - title=_("%(title)s: Submission report") % {"title": submission.form.name}, + title=_("%(title)s: Submission report (%(reference)s)") + % { + "title": submission.form.name, + "reference": submission.public_registration_reference, + }, submission=submission, task_id=task.request.id, ) From a4fe8d0cd5e1ab709be6537e2cc909c234ca317b Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Wed, 3 Apr 2024 10:06:46 +0200 Subject: [PATCH 3/3] :white_check_mark: [#4005] Test submission reference in report title --- src/openforms/submissions/tests/test_tasks_pdf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/openforms/submissions/tests/test_tasks_pdf.py b/src/openforms/submissions/tests/test_tasks_pdf.py index 029fd52062..6390c6d9e1 100644 --- a/src/openforms/submissions/tests/test_tasks_pdf.py +++ b/src/openforms/submissions/tests/test_tasks_pdf.py @@ -17,7 +17,10 @@ class SubmissionReportGenerationTests(TestCase): def test_submission_report_metadata(self): submission = SubmissionFactory.create( - completed=True, form__name="Test Form", form__slug="test-form" + completed=True, + form__name="Test Form", + form__slug="test-form", + public_registration_reference="OF-TRALALA", ) generate_submission_report.request.id = "some-id" @@ -25,7 +28,9 @@ def test_submission_report_metadata(self): report = SubmissionReport.objects.get() self.assertEqual( - _("%(title)s: Submission report") % {"title": "Test Form"}, report.title + _("%(title)s: Submission report (%(reference)s)") + % {"title": "Test Form", "reference": "OF-TRALALA"}, + report.title, ) self.assertEqual(submission, report.submission) self.assertTrue(report.content.name.endswith("test-form.pdf"))