Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change label filter intervention contractors and filter null value on project contractors detail view (ref #3820) #4061

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ CHANGELOG
- Fix OptionalRangeFilter and CustomDateFromToRangeFilter labels translation (fixes #3852)
- Fix crash on migrate when db username or dbname contains dash
- Fix Intervention end date should only be mandatory in last step of Suricate Workflow (refs #3825)"
- Change label filter intervention contractors and filter null value on project contractors detail view (#3820)

**Improvements**

- Add `report` model on Intervention filters in module list (#3972)

**Documentation**

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

@classproperty
def intervention_contractors_verbose_name(cls):
Expand Down
Loading