Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering based on comparisons in django

I have a django model with a field Reminder_End_Date = models.DateField(). I have to filter all records of the model which have reminder date greater than todays date.

However when I try to use the following statement, it does not work:

now=datetime.date.today()
reminderlist=Reminder.objects.filter(Reminder_End_Date>now )

Can anyone tell how to go about this? Thanks in advance

like image 615
thestudent Avatar asked Feb 27 '23 00:02

thestudent


1 Answers

This is basic Django query syntax. See the documentation on making queries.

reminderlist = Reminder.objects.filter(Reminder_End_Date__gt=now )
like image 183
Daniel Roseman Avatar answered Mar 04 '23 06:03

Daniel Roseman