I currently have:
@classmethod
def get_past_week(self):
start_date = datetime.now().date()
end_date = datetime.now().date() - timedelta(weeks=1)
return MyModel.objects.filter(pub_date__range=(end_date, start_date
)).aggregate(Sum('off_hours'))
which simply pulls all posts from the current date minus 7 days
I want to pull posts from within the same day factoring in the time at the
moment. Thus if the time is 15:00 GMT now, I want all posts from 14:59:49
GMT back to 00:00:01 GMT of the same day.
How can I do something like that?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/03d2a13b-46ea-4e86-ba1a-393016c25360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.