def get(self, request, query): parsed = parse_query(query) if any([f for f in parsed['filters'] if f[0] == 'docket']): # they've filtered to a single docket, so default to document aggregation new_url = reverse('search-documents-view', kwargs={'query': query}) else: # default to docket aggregation new_url = reverse('search-dockets-view', kwargs={'query': query}) if request.META['QUERY_STRING']: new_url += "?" + request.META['QUERY_STRING'] return Response(status=status.HTTP_302_FOUND, headers={'Location': new_url})
def set_query(self, query): parsed = parse_query(query) self.raw_query = query self.text_query = parsed['text'] self.filters = parsed['filters']