(self, queryset, field)
return queryset
Filters the queryset by the before/after params if are provided
Filters the queryset by the before/after params if are provided
Filters the queryset by the before / after params if are provided
def filter_before_after(self, queryset, field):
        """
        Filters the queryset by the before/after params if are provided
        """
        before = self.request.query_params.get("before")
        if before:
            try:
                before = iso8601.parse_date(before)
                queryset = queryset.filter(**{field + "__lte": before})
            except Exception:
                queryset = queryset.filter(pk=-1)

        after = self.request.query_params.get("after")
        if after:
            try:
                after = iso8601.parse_date(after)
                queryset = queryset.filter(**{field + "__gte": after})
            except Exception:
                queryset = queryset.filter(pk=-1)

        return queryset
def filter_before_after ( self , queryset , field ) : before = self . request . query_params . get ( "before" ) if before : try : before = iso8601 . parse_date ( before ) queryset = queryset . filter ( * * { field + "__lte" : before } ) except Exception : queryset = queryset . filter ( pk = - 1 ) after = self . request . query_params . get ( "after" ) if after : try : after = iso8601 . parse_date ( after ) queryset = queryset . filter ( * * { field + "__gte" : after } ) except Exception : queryset = queryset . filter ( pk = - 1 ) return queryset