Well I've successfully subclassed the base aggregate class from Russell above and it works as expected, however when I try and group by my new aggregate field I get a FieldError. This makes sense to me because when I call values on the queryset the new field hasn't been created yet.
Here's an example of what I mean: queryset.objects.values('date_group').annotate(date_group=Date ('datefield')) I've solved this in the past with calls like this: all_objects = queryset.all() all_objects.query.group_by=['date_group'] annotated_objects = all_objects.annotate( date_group=Date ('datefield') ) Is there a better way than this to accomplish grouping by aggregate fields? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---