【发布时间】:2021-05-05 07:55:35
【问题描述】:
我有一个查询集;
queryset = tagReferenceLocationInfo.objects.select_related('ref').filter(tag_id__in=id_list, date__gte=startDate, date__lte=endDate)
我得到了这个查询集结果数据作为一个列表;
data = list(queryset)
此数据包含 ref 对象内的 referenceName。
我用过;
data = serialize('json', allObj)
我只能得到“ref”值;
[{"model": "equipment.tagreferencelocationinfo", "pk": 10015778, "fields": {"tag": 13, "ref": 26, "map": 1, "corX": 469, "corY": 295, "date": "2021-04-29T06:30:52.032Z"}}, {"model": "equipment.tagreferencelocationinfo", "pk": 10015812, "fields": {"tag": 13, "ref": 26, "map": 1, "corX": 473, "corY": 297, "date": "2021-04-29T06:31:02.507Z"}}]
我还想在此数据中获取“referenceName”。怎么加呢?
【问题讨论】: