0
我有一个返回编码为JSON出货量的列表视图...如何在JSON字符串中包含注释?
def get_new_shipments(request):
# ...
shipments = Shipment.objects.filter(filter).exclude(**exclude).order_by(order) \
.annotate(num_bids=Count('bids'), min_bid=Min('bids__amount'), max_bid=Max('bids__amount'))
return json_response(shipments)
def json_response(data):
response = HttpResponse(mimetype='application/json')
serializer = serializers.get_serializer("json")()
data = list(data)
serializer.serialize(data, ensure_ascii=False, stream=response)
return response
但我没有看到JSON这些标注任何地方...我怎么被列入其中?