1π
β
Iβm not sure if Iβve fully understood what youβre asking, but to filter a QuerySet to only display objects with a next_action_date
in the future you can use:
import datetime
LeadContact.objects.filter(next_action_date__gte=datetime.date.today())
and to display only those with dates in the past use:
LeadContact.objects.filter(next_action_date__lte=datetime.date.today())
See this answer for a more detailed guide on filtering QuerySets by date. In particular, if the type of your next_action_date
field is datetime, use datetime.datetime.now()
rather than datetime.date.today()
. More info also in the QuerySet docs.
π€FraserES
Source:stackexchange.com