Answer the question
In order to leave comments, you need to log in
Why doesn't fetching date_range by Django date work?
The model has date = models.DateField(null=True, verbose_name="Show Date")
The code works:
def show_dates():
now = datetime.now()
dates = Show.objects.exclude(date=datetime.now())
return {"dates": dates}
def show_dates():
now = datetime.now()
dates = Show.objects.filter(date__range=[datetime.now(), timedelta(days=7)])
return {"dates": dates}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question