res= table.objects.values('lat','lng')
res1 = table1.objects.values('lat','lng')
res1=[{'lat': u'22.216021036729217', 'lng': u'84.83377508819103'}]
res=[{'lat': u'15.898394035175443', 'lng': u'73.82306920364499'}]
我想将res
和res1
的结果添加到poi
中:
poi = [{'lat': u'15.898394035175443', 'lng': u'73.82306920364499'},{'lat': u'22.216021036729217', 'lng': u'84.83377508819103'} ]
我尝试了poi=list(res)+list(res1)
,但收到了以下错误:
list referenced before assignment
答案 0 :(得分:0)
您可以使用list运算符将ValuesQuerySet转换为列表
res= table.objects.values('lat','lng') res1 = table 1.objects.values('lat','lng')
poi = list(res) + list(res1)