parameters: (self, queryset, field)
return_statement: return queryset
docstring: Filters the queryset by the before/after params if are provided
docstring_summary: Filters the queryset by the before/after params if are provided
docstring_tokens: Filters the queryset by the before / after params if are provided
function: 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
function_tokens: 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