From 5f819ea0d86c7de412c2ebb600afcfef77d49a13 Mon Sep 17 00:00:00 2001 From: claire-peters Date: Fri, 13 Sep 2024 18:28:26 -0400 Subject: [PATCH] update filters --- coldfront/plugins/api/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/coldfront/plugins/api/views.py b/coldfront/plugins/api/views.py index a17662292..7f8acad41 100644 --- a/coldfront/plugins/api/views.py +++ b/coldfront/plugins/api/views.py @@ -121,6 +121,9 @@ class AllocationRequestFilter(filters.FilterSet): created = filters.DateFromToRangeFilter(label='Created Range') fulfilled = filters.BooleanFilter(label='Fulfilled', method='filter_fulfilled') fulfilled_date = filters.DateFromToRangeFilter(label='Fulfilled Date Range') + requested_size = filters.NumericRangeFilter(label='Requested Size', field_name='requested_size') + pi = filters.CharFilter(label='PI', field_name='project__pi__full_name', lookup_expr='icontains') + project = filters.CharFilter(label='Project', field_name='project__title', lookup_expr='icontains') time_to_fulfillment = filters.NumericRangeFilter(label='Time-to-fulfillment Range', method='filter_time_to_fulfillment') class Meta: @@ -129,6 +132,8 @@ class Meta: 'created', 'fulfilled', 'fulfilled_date', + 'pi', + 'requested_size', 'time_to_fulfillment', ] @@ -262,6 +267,8 @@ class AllocationChangeRequestFilter(filters.FilterSet): created = filters.DateFromToRangeFilter() fulfilled = filters.BooleanFilter(label='Fulfilled', method='filter_fulfilled') fulfilled_date = filters.DateFromToRangeFilter(label='Fulfilled Date Range') + pi = filters.CharFilter(label='PI', field_name='allocation__project__pi__full_name', lookup_expr='icontains') + project = filters.CharFilter(label='Project', field_name='allocation__project__title', lookup_expr='icontains') time_to_fulfillment = filters.NumericRangeFilter(label='Time-to-fulfillment Range', method='filter_time_to_fulfillment') class Meta: @@ -270,6 +277,8 @@ class Meta: 'created', 'fulfilled', 'fulfilled_date', + 'pi', + 'project', 'time_to_fulfillment', ]