I have some records in the database and I need to group them by the year, the problem is: if the day or month changes then django isn't grouping them.
This is my queryset: classifications = ClassificationDocument.objects.filter(Q(area=request_area) and Q(classification__is_active=True)) \ .annotate(code=F('classification__code'), title=F('classification__title'), documents=Count('classification'))\ .annotate(year=ExtractYear('created')) \ .only('documents', 'title', 'code', 'year') it's there any solution for this? Thanks to everyone . -- 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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cf108d51-bc3d-449c-814f-2d2b304357ecn%40googlegroups.com.