From c8cd6698bceb450aa5adfa8ceda0a5dc0b0c12f8 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 11 Sep 2023 12:20:09 +0200 Subject: [PATCH] Add rule to display tender contact company_name (override author info) --- lemarche/templates/tenders/_detail_contact.html | 4 ++-- lemarche/tenders/models.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lemarche/templates/tenders/_detail_contact.html b/lemarche/templates/tenders/_detail_contact.html index 504f41f94..11de4b7fa 100644 --- a/lemarche/templates/tenders/_detail_contact.html +++ b/lemarche/templates/tenders/_detail_contact.html @@ -14,10 +14,10 @@

{{ tender.contact_full_name|safe }} {% endif %} - {% if tender.author.company_name %} + {% if tender.contact_company_name_display %}
- {{ tender.author.company_name }} + {{ tender.contact_company_name_display }}
{% endif %} {% if tender.can_display_contact_email or source == "alert" and not tender.response_kind_is_only_external %} diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index 1b325c4dd..51a6b10a3 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -440,6 +440,13 @@ def save(self, *args, **kwargs): def contact_full_name(self) -> str: return f"{self.contact_first_name} {self.contact_last_name}" + def contact_company_name_display(self) -> str: + if self.contact_company_name: + return self.contact_company_name + elif self.author.company_name: + return self.author.company_name + return "" + def sectors_list(self): return self.sectors.form_filter_queryset().values_list("name", flat=True)