[Answer]-Count data by day

1👍

You should try Count('created__day'). At least created__day should work in the filtering part of the query, so intuitively, it should also work with Count.

EDIT:

…nope, it doesn’t work, but you might find a solution in Count number of records by date in Django.

So basically you have to use .extra(...) combined with some (potentially non-standard) SQL functions that extract just a part of a datetime (e.g. the MySQL DATE()), and then use the resulting field to Count.

Leave a comment