Answers for "how to use query_params in get_object djangorestframework"

0

how to use query_params in get_object djangorestframework

# 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)
    ...
Posted by: Guest on June-09-2021

Code answers related to "how to use query_params in get_object djangorestframework"

Python Answers by Framework

Browse Popular Code Answers by Language