0
我想創建一個表,使用SQL查詢使用我的原始模型中的某些列,但我不能那樣做。 我做了以下,但它確實顯示所有的列,但只是所選列的值。我要生成只是選擇的值的表:在Django上使用查詢創建表
def listing(request):
table = Example.objects.values('nome','data_nascimento','nivel_academico','curso','instituicao')
return render(request, 'listDB.html', {'latest_match_list':table, 'user':request.user.username})
你是如何在模板中使用它,以及你看到了什麼結果? –