django 获取当前筛选条件下的queryset,获取serializer之后的数据

手动获取筛选结果

queryset = self.filter_queryset(self.get_queryset())

手动序列化

        objs = StockLackPicking.objects.using('read_default').filter(id__in=ids)
        serializers = StockLackPickingSerializer(objs, many=True)
        serializers_data = serializers.data
        data_dict = {}
        from utils.common import handel_utc_time
        for data in serializers_data:
            data['create_date'] = handel_utc_time(data['create_date'])
            data['actual_date'] = handel_utc_time(data['actual_date'])
            order_id = data['id']
            data_dict[order_id] = data
posted @ 2021-02-01 18:16  那时一个人  阅读(1025)  评论(0编辑  收藏  举报