How do I get the number of objects per day using django?
Posted
by Keith
on Stack Overflow
See other posts from Stack Overflow
or by Keith
Published on 2010-04-28T23:48:49Z
Indexed on
2010/04/30
0:37 UTC
Read the original article
Hit count: 306
django
I have a django model with a DateTimeField.
class Point(models.Model):
somedata = models.CharField(max_length=256)
time = models.DateTimeField()
I want to get a count of the number of these objects for each day. I can do this with the following SQL query, but don't know how to do it through django.
SELECT DATE(`time`), Count(*)
FROM `app_point`
GROUP BY DATE(`time`)
Being able to restrict the results to a date range would also be good.
© Stack Overflow or respective owner