bump. Can anyone tell me if this looks like a bug in Django?
On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote: > Hi all, > > I've got a quick use case that I think should work according to the > docs, but it's not. In this case, Domain objects have a reverse fkey > relation named "reports", and the Report model has an "updated" > field. I'd like to annotate and order Domains by the max value of > "updated" for all related reports. The following interactive session > shows the behavior pretty well. > > >>> qs = > >>> Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated') > >>> qs.count() > 1577 > >>> print qs[0].last_updated > > IndexError: list index out of range>>> qs.count() > > InternalError: current transaction is aborted, commands ignored until > end of transaction block > > >>> connection._rollback() > > If I drop off the order_by call, things appear to work again. > > >>> qs = Domain.objects.annotate(last_updated=Max('reports__updated')) > >>> qs.count() > 1577 > >>> print qs[0].last_updated > > 2009-05-28 13:25:55.027600 > > What am I missing here (besides a thorough understanding of > aggregation)? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---