def index(request):
# print(keyword.objects.all())
# for i in keyword.objects.all():
# print(i)
# print(keyword.objects.filter(keyID=1))
# print(keyword.objects.count())
indexList = []
for i in range(1,keydata.objects.count()+1):
iList = []
Name = ""
# print(i)
iList.append(i)
# 颜色Color
# print(keydata.objects.get(pk=i).Color)
iList.append(keydata.objects.get(pk=i).Color)
# 出现了多少次
# print(key.objects.filter(keyID=i).count())
iList.append(key.objects.filter(keyID=i).count())
# 出现了多少个关键词
for keyName in keyword.objects.filter(keyID=i):
# print(keyName.key)
Name += keyName.key + " "
iList.append(Name)
indexList += [iList]
print(indexList)
return render(request, 'myapp/index.html', {'indexList': indexList})
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!