开发者

Filtering based on comparisons in django

开发者 https://www.devze.com 2023-01-21 00:41 出处:网络
I have a django model with a field Reminder_End_Date = mode开发者_开发技巧ls.DateField(). I have to filter all records of the model which have reminder date greater than todays date.

I have a django model with a field Reminder_End_Date = mode开发者_开发技巧ls.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


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

reminderlist = Reminder.objects.filter(Reminder_End_Date__gt=now )
0

精彩评论

暂无评论...
验证码 换一张
取 消