diff --git a/docs/changelog.rst b/docs/changelog.rst index 27fd29bd5c..b74c187b79 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,10 +9,7 @@ CHANGELOG - Fix OptionalRangeFilter and CustomDateFromToRangeFilter labels translation (fixes #3852) - Fix crash on migrate when db username or dbname contains dash - -**Improvements** - -- Add `report` model on Intervention filters in module list (#3972) +- Change label filter intervention contractors and filter null value on project contractors detail view (#3820) **Documentation** @@ -21,6 +18,7 @@ CHANGELOG **Improvements** - Remove unused `postgres` volume in docker compose file for production +- Add `report` model on Intervention filters in module list (#3972) 2.104.2 (2024-04-04) diff --git a/geotrek/maintenance/filters.py b/geotrek/maintenance/filters.py index 8e6937b798..e47f59cfaa 100644 --- a/geotrek/maintenance/filters.py +++ b/geotrek/maintenance/filters.py @@ -182,7 +182,7 @@ class ProjectFilterSet(StructureRelatedFilterSet): district = ProjectIntersectionFilterDistrict(label=_('District'), lookup_expr='intersects', required=False) area_type = ProjectIntersectionFilterRestrictedAreaType(label=_('Restricted area type'), lookup_expr='intersects', required=False) area = ProjectIntersectionFilterRestrictedArea(label=_('Restricted area'), lookup_expr='intersects', required=False) - contractors = ModelMultipleChoiceFilter(label=_("Intervention contractors"), queryset=Contractor.objects.all(), method='filter_contractors') + contractors = ModelMultipleChoiceFilter(label=_("Contractors"), queryset=Contractor.objects.all(), method='filter_contractors') class Meta(StructureRelatedFilterSet.Meta): model = Project diff --git a/geotrek/maintenance/models.py b/geotrek/maintenance/models.py index d93db6eefa..29f2773c39 100755 --- a/geotrek/maintenance/models.py +++ b/geotrek/maintenance/models.py @@ -553,7 +553,7 @@ def interventions_csv_display(self): @property def intervention_contractors(self): return self.interventions.aggregate( - intervention_contractors=ArrayAgg('contractors__contractor', distinct=True))['intervention_contractors'] + intervention_contractors=ArrayAgg('contractors__contractor', distinct=True, filter=Q(contractors__isnull=False)))['intervention_contractors'] @classproperty def intervention_contractors_verbose_name(cls):