Skip to content

Commit

Permalink
Merge branch 'master' into refactor_filters
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos authored Oct 27, 2023
2 parents 935e6d2 + 26d1e8e commit 6420a7b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions geotrek/maintenance/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ class Meta(StructureRelatedFilterSet.Meta):
'status', 'type', 'stake', 'subcontracting', 'project', 'on',
]

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.form.fields['year'].choices = Intervention.objects.year_choices()


class ProjectFilterSet(StructureRelatedFilterSet):
bbox = PythonPolygonFilter(field_name='geom')
Expand All @@ -170,3 +174,7 @@ def filter_year(self, qs, name, values):
for value in values:
q |= Q(begin_year__lte=value, end_year__gte=value)
return qs.filter(q)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.form.fields['year'].choices = Project.objects.year_choices()

0 comments on commit 6420a7b

Please sign in to comment.