1👍
✅
You can filter the Event
s with Event.objects.filter(event_date__gte=today)
to retrieve only Event
s that start today or in the future:
from django.utils.timezone import now
def dashboard_view(request):
today = now().date()
game_list=Game.objects.all()
event_list = Event.objects.filter(event_date__gte=today).order_by('event_date')
return render(request, 'dashboard.html', {'game_list':game_list, 'event_list': event_list})
Source:stackexchange.com