Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
    ...
Source by github.com #
 
PREVIOUS NEXT
Tagged: #djangorestframework
ADD COMMENT
Topic
Name
3+6 =