diff --git a/lemarche/tenders/admin.py b/lemarche/tenders/admin.py index 94b37ab55..ae6929234 100644 --- a/lemarche/tenders/admin.py +++ b/lemarche/tenders/admin.py @@ -433,7 +433,7 @@ def title_with_link(self, tender): title_with_link.admin_order_field = "title" def amount_display(self, tender): - return f"{tender.amount_exact} €" if tender.amount_exact else tender.get_amount_display() + return tender.amount_admin_display amount_display.short_description = "Budget" amount_display.admin_order_field = "amount_exact" diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index 4e907f8a6..af4d9fa49 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -661,6 +661,10 @@ def amount_display(self) -> str: else: return "Non renseigné" + @cached_property + def amount_admin_display(self) -> str: + return f"{self.amount_exact} €" if self.amount_exact else self.get_amount_display() + def questions_list(self): return list(self.questions.values("id", "text"))