Skip to content

Commit

Permalink
Add rule to display tender contact company_name (override author info)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Sep 11, 2023
1 parent cfcaa8f commit c8cd669
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lemarche/templates/tenders/_detail_contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ <h2>
{{ tender.contact_full_name|safe }}
</div>
{% endif %}
{% if tender.author.company_name %}
{% if tender.contact_company_name_display %}
<div class="col-md-6">
<i class="ri-building-4-line"></i>
{{ tender.author.company_name }}
{{ tender.contact_company_name_display }}
</div>
{% endif %}
{% if tender.can_display_contact_email or source == "alert" and not tender.response_kind_is_only_external %}
Expand Down
7 changes: 7 additions & 0 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c8cd669

Please sign in to comment.