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 +]