4👍
✅
You need to use queryset filter lookups, __gte (greater than or equal):
announcements = Announcement.objects.all().filter(date_start__gte = datetime.now())
3👍
This syntax is wrong:
announcements = Announcement.objects.all().filter(date_start >= datetime.now())
filter
requires Python keyword arguments. So in effect you could:
announcements = Announcement.objects.all().filter(date_start__gte=datetime.now())
More on that on Django docs: Making queries: Field lookups.
- [Django]-Django model error maximum recursion depth exceeded
- [Django]-Why is my JSON from Django being cut-off at about 2.1MB?
Source:stackexchange.com