Hi!
I was wondering if anybody knew how to create a list based on that list having a DateTime attribute that is less than 30 days old. I already have a boolean in the model itself of 'published_recent_month' that can say if it is or is not published within a month, but how do I put into that a list to put into a template? I know how to do a list based on pub_date and have it be a certain length, but I would rather have the list be dynamic to usage.
Thanks a lot!
abbreviated model to show the boolean definition I have:
class Model(models.Model):
...
def published_recent_month(self):
return self.pub_date >= timezone.localtime(timezone.now()) - datetime.timedelta(days=30)
abbreviated view using what I already know:
def index(request):
...
latest_25_list =Model.objects.order_by('-pub_date')[:25]