From 264c3bb6d888f2b0c07f8288a9585a0adf45a6cd Mon Sep 17 00:00:00 2001 From: AlexandreJunod Date: Thu, 17 Aug 2023 09:46:16 +0200 Subject: [PATCH] fix test --- geocity/apps/reports/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/geocity/apps/reports/models.py b/geocity/apps/reports/models.py index fdd278cf4..fe2b61b6f 100644 --- a/geocity/apps/reports/models.py +++ b/geocity/apps/reports/models.py @@ -729,6 +729,8 @@ class Meta: verbose_name = _("Destinataire") def _get_recipient(self, request, base_context): + from geocity.apps.submissions.models import ContactType + properties = base_context["request_data"]["properties"] contacts = properties["contacts"] @@ -737,8 +739,10 @@ def _get_recipient(self, request, base_context): # Empty string, if nothing is found, it won't return anything from json and will let empty the section instead of crashing selected_recipient = "" + author = ContactType.objects.get(name="Auteur") + for recipient in recipients: - if recipient.name == "Auteur" and "author" in properties: + if recipient == author and "author" in properties: selected_recipient = properties["author"] elif contacts: for contact in contacts.values():