#12687: Using exclude on a queryset with an annotate field give attribute error. --------------------------------------+------------------------------------- Reporter: AsgeirM | Owner: Status: new | Milestone: 1.3 Component: ORM aggregation | Version: 1.2 Resolution: | Keywords: annotate exclude AttributeError Stage: Accepted | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------+------------------------------------- Comment (by Petr Marhoun <petr.marh...@gmail.com>):
Ticket #13356 was closed as duplicate of this patch - It is true that is seems to be quite similar and there is more information here. But I think that it has more simple example of the problem and it could be also here. Following code works : {{{ #!python from django.contrib.auth.models import User from django.db.models import Count User.objects.filter(id__in=[]).annotate(Count('groups')) [] User.objects.filter(id__in=[]).count() 0 }}} But following code raise !EmptyResultSet: {{{ #!python User.objects.filter(id__in=[]).annotate(Count('groups')).count() }}} -- Ticket URL: <http://code.djangoproject.com/ticket/12687#comment:4> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.