0
我的意见,采取从列表字典值:如何使用Django模板
post_details = Post.objects.all()
for each in post_details:
post_like_list=PostLikes.objects.filter(post = each)
pl=len(post_like_list)
dict1={"post":each}
dict2={"how many likes":pl}
list.append([dict1,dict2])
print list
我的目录= [[{ '后':住宿},{ '有多少喜欢':0}],[{”后':选举},{'多少个喜欢':0}],[{'后':},{'多少个喜欢':3}],[{'''''','' :1}]]
通过使用django模板,我怎样才能从列表中的字典中获得'后'和'多少喜欢'?
+1“理智”... –