Does anyone have an example of a "bat-ready" grouping by date? I've tried all of this here ...
Subscription.objects.extra(select={'day': 'date(created_at)'}).values('day').annotate(available=Count('created_at'))
from django.db.models.aggregates import Count
Subscription.objects.extra({'date':"date(created_at)"}).values('date').annotate(count=Count('id'))
from django.db import connection
from django.db.models import Count
select = {'day': connection.ops.date_trunc_sql('day', 'created_at')}
Subscription.objects.extra(select=select).values('day').annotate(number=Count('id'))
But none returned what I want:
2016-01-22, 10
2016-01-21, 5
2016-01-15, 7