如何将此格式更改为简单列表
[{'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 350}, {'qte': 11}]
这是这个请求的结果
inst = Produit.objects.values('qte')
print inst
我需要像这样的格式
[100,100,100,100,100,100.....]
请您参考如下方法:
您可以使用 values_list使用 flat=True 参数代替 values。
inst = Produit.objects.values_list('qte', flat=True)
