名單,我有其中有一個列表屬性的模型:我怎樣才能從模型在models.py模板
Class Controller(models.Model):
def controller(self):
result = []
#...do some works here...
result = xxx
現在我想用「結果」屬性模板在views.py我有:
def results(request):
cmodel = Controller()
cmodel.controller()
firstList = get_list_or_404(Controller, 'I am not sure how to write this filter')
return render_to_response('blablabla/')
我不知道怎麼寫的過濾器,因爲樣品是給類似「PK = 1」,但我沒有任何主鍵或ID爲'結果'對象。誰能幫我?謝謝。
你試圖完成什麼? –