0
def home(request):
terminate = Tvserie.objects.filter(status='Terminata' or status='Cancellata').order_by('?')[0:4]
return render_to_response('Home.html',{'terminate':terminate})
這是錯誤的,爲什麼呢? 如何創建屬性「status」的多重過濾器?
型號:
class Tvserie(models.Model):
status_choices = (('Non iniziata', 'Non iniziata'),('In corso', 'In corso'),
('In pausa', 'In pausa'),('Rinnovata', 'Rinnovata'),
('Cancellata', 'Cancellata'),('Terminata', 'Terminata'))
status = models.CharField(max_length = 30, choices=status_choices)
是的!謝謝! – JacopoWoty
不客氣。現在,如果您可以將此答案標記爲已接受.. –
另一個問題 - > http://stackoverflow.com/questions/30686089/how-can-i-save-the-data-even-if-their-value-in -a-form-is-null – JacopoWoty