1
試圖讓查詢集某些對象基礎上,date.dayDjango的date.day查詢集查找
#Model
class Entry(models.Model):
...
from = models.DateField(default=datetime.date.today())
...
#view
day = 2
entryes = Entry.objects.all()
#works
day_entryes = entryes.filter(from__day=day)
#do not work
day_entryes = entryes.filter(from__day__lte=day)
我得到了以下錯誤:
Join on field 'from' not permitted. Did you misspell 'day' for the lookup type?
爲什麼它不工作?