1đź‘Ť
âś…
from datetime import datetime, timedelta
result = A.objects.filter(date_sent__lt=datetime.date.today() - timedelta(days=1))
👤pkacprzak
0đź‘Ť
If A
is the name of your class, I think you have to call A.objects.get
first:
A.objects.get(
Q((date_sent - datetime.now()).days > 1)
)
👤Talvalin
- [Answer]-Django how to not use cached queryset while iterating?
- [Answer]-Django – access variables in template
- [Answer]-Show last three entries before a specific one
- [Answer]-Class-based view mess about overwriting generic view methods
- [Answer]-Tracking of field changes in Django
Source:stackexchange.com