Actually, somewhere in the view:
dif = datetime.timedelta(days=1)
today = datetime.date.today()
yesterday = today - dif
ex = Fact.objects.filter(fecha_fact__lte=today ,fecha_fact__gte=yesterday )
This is the result of SQL Query:
SELECT `facts_fact`.`id` ...
FROM `facts_fact`
WHERE (`facts_fact`.`fecha_fact` >= 2009-09-21 AND `facts_fact`.`fecha_fact` <= 2009-09-22 )
There is a way to make Django a WHERE BETWEEN clause instead of> = <=?
:) thanks.
source
share