📜  如何在 get_object djangorestframework 中使用 query_params - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:19.288000             🧑  作者: Mango

代码示例1
# 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)
    ...