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

Add created_before and created_after filters to observations endpoint #241

Merged
merged 5 commits into from
Jun 23, 2022
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions observation_portal/observations/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ class ObservationFilter(mixins.CustomIsoDateTimeFilterMixin, django_filters.Filt
label='Modified After (Inclusive)',
widget=forms.TextInput(attrs={'class': 'input', 'type': 'date'})
)
created_after = django_filters.IsoDateTimeFilter(
field_name='created',
lookup_expr='gte',
label='Created After (Inclusive)',
widget=forms.TextInput(attrs={'class': 'input', 'type': 'date'})
)
created_before = django_filters.IsoDateTimeFilter(
field_name='created',
lookup_expr='lt',
label='Created Before',
widget=forms.TextInput(attrs={'class': 'input', 'type': 'date'})
)
request_id = django_filters.NumberFilter(field_name='request__id')
request_group_id = django_filters.NumberFilter(field_name='request__request_group__id', label='Request Group ID')
state = django_filters.MultipleChoiceFilter(choices=Observation.STATE_CHOICES, field_name='state')
Expand Down