开发者

django, distinct() not behaving

开发者 https://www.devze.com 2023-01-15 14:38 出处:网络
For some reason duplicate values aren\'t eliminated. 开发者_如何学JAVArecords = Records.objects.all()

For some reason duplicate values aren't eliminated.

开发者_如何学JAVArecords = Records.objects.all()
records2 = records.values_list('columna','columna').distinct()
print records2

I must be doing something stupid


My solution was to cast the values_list to a set (to remove duplicates) then back to a list

0

精彩评论

暂无评论...
验证码 换一张
取 消