From d2eaf73a9e62e6ebd2847b8a24c27fef4ff03906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Mon, 29 Jan 2024 17:56:15 +0100 Subject: [PATCH] exclude ia source on normal siae list --- lemarche/siaes/admin.py | 1 + lemarche/tenders/admin.py | 4 ++-- lemarche/tenders/constants.py | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lemarche/siaes/admin.py b/lemarche/siaes/admin.py index 1bd4236c4..7ce35d3e5 100644 --- a/lemarche/siaes/admin.py +++ b/lemarche/siaes/admin.py @@ -460,6 +460,7 @@ def lookup_allowed(self, lookup, *args, **kwargs): "tendersiae__detail_contact_click_date__isnull", "tendersiae__detail_cocontracting_click_date__isnull", "tendersiae__detail_not_interested_click_date__isnull", + "tendersiae__source__in", ]: return True return super().lookup_allowed(lookup, *args, **kwargs) diff --git a/lemarche/tenders/admin.py b/lemarche/tenders/admin.py index 1a0de7f86..ec9b64e09 100644 --- a/lemarche/tenders/admin.py +++ b/lemarche/tenders/admin.py @@ -446,9 +446,9 @@ def question_count_with_link(self, tender): question_count_with_link.short_description = TenderQuestion._meta.verbose_name_plural - # TODO: les siaes trouvés par l'IA apparaissent aussi ici : /admin/siaes/siae/?tenders__in=7 def siae_count_annotated_with_link(self, tender): - url = reverse("admin:siaes_siae_changelist") + f"?tenders__in={tender.id}" + url = reverse("admin:siaes_siae_changelist") + f"?tenders__in={tender.id}&tendersiae__source__in=" + url += ",".join(tender_constants.TENDER_SIAE_SOURCES_EXCEPT_IA) return format_html(f'{getattr(tender, "siae_count_annotated", 0)}') siae_count_annotated_with_link.short_description = "S. concernées" diff --git a/lemarche/tenders/constants.py b/lemarche/tenders/constants.py index 313d031e9..508adb277 100644 --- a/lemarche/tenders/constants.py +++ b/lemarche/tenders/constants.py @@ -145,3 +145,7 @@ (TENDER_SIAE_SOURCE_LINK, "Lien"), (TENDER_SIAE_SOURCE_AI, "IA"), ) + +TENDER_SIAE_SOURCES_EXCEPT_IA = [ + source[0] for source in TENDER_SIAE_SOURCE_CHOICES if source[0] != TENDER_SIAE_SOURCE_AI +]