#26010: I need to count objects in a queryset by year and month
-------------------------------+--------------------
Reporter: mahmoodkhan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Currently, I am doing something along the lines of:
Item.objects.all().\
extra(select={'year': "EXTRACT(year FROM date)"}).\
values('year').annotate(count_items=Count('date'))
--
Ticket URL: <https://code.djangoproject.com/ticket/26010>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.0baa0fce191347a5e38ec2003409c155%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.