class FilterMealList(views.APIView):
def get(self, request, **kwargs):
user_id = self.kwargs['user_id']
from_time = self.request.GET.get('from_time')
to_time = self.request.GET.get('to_time')
from_date = self.request.GET.get('from_date')
to_date = self.request.GET.get('to_date')
# …
# generics.py
class GenericAPIView(APIView):
...
def dispatch(self, request, *args, **kwargs):
lookup_param = request.GET.get(self.lookup_field, None)
if lookup_param:
kwargs[lookup_field] = lookup_param
return Super(GenericAPIView, self).dispatch(request, *args, **kwargs)
...