Skip to content

Commit

Permalink
🐛 fix: change label filter intervention contractor and filter null va…
Browse files Browse the repository at this point in the history
…lue on project contractor detail view (ref #3820)
  • Loading branch information
juggler31 committed Apr 9, 2024
1 parent ed85264 commit 740ca2c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CHANGELOG
**Bug fixes**

- Fix OptionalRangeFilter and CustomDateFromToRangeFilter labels translation (fixes #3852)
- Change label filter intervention contractor and filter null value on project contractor detail view (#3820)

**Documentation**

Expand Down
2 changes: 1 addition & 1 deletion geotrek/maintenance/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,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
Expand Down
2 changes: 1 addition & 1 deletion geotrek/maintenance/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__contractor__isnull=False)))['intervention_contractors']

@classproperty
def intervention_contractors_verbose_name(cls):
Expand Down

0 comments on commit 740ca2c

Please sign in to comment.