Is there a way to get all objects with a date less than a month ago in django.
Something like:
items = Item.objects.filter(less than a month old).order_by(...)
Is there a way to get all objects with a date less than a month ago in django.
Something like:
items = Item.objects.filter(less than a month old).order_by(...)
Do this:
This will cater for all cases I can think of.
What is your definition of a "month"? 30 days? 31 days? Past that, this should do it:
Takes advantange of the gte field lookup.
Where aMonthAgo would be calculated by datetime and timedelta.