Django date range from today and 10 days ago
I have a model:
title = models.CharField(max_length=120)
description = models.TextField()
post_date = models.DateTimeField(default=timezone.now)
published = models.BooleanField(default=False)
vote = models.IntegerField(default=0)
Here I want to display questions posted within 10 days, for example
Question.objects.filter(post_date__range=(today, 10 days back))
How can i do this?
+3
source to share