restful 在接口中获取 传过来的值

# 竞价    GET: http://www.xxx.com/deposit/?item_id=1
# 提交竞价 POST: http://www.xxx.com/deposit/
class BidView(ListAPIView, CreateAPIView):
    queryset = models.BidRecord.objects.all()
    serializer_class = BidModelSerializer

    def get_queryset(self):
        item_id = self.request.query_params.get('item_id')
        return self.queryset.filter(item_id=item_id)

 

posted @ 2020-03-17 22:44  流年中渲染了微笑  阅读(446)  评论(0编辑  收藏  举报