#24065: aggregate dont find column of annotate
-------------------------------------+-------------------------------------
     Reporter:  mateuspadua          |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  1.7
  (models, ORM)                      |   Keywords:  aggregate annotate
     Severity:  Normal               |  fielderror
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 If we try this query, everything works normally

 {{{
 
Entry.objects.annotate(num_authors=Count('authors')).aggregate(Avg('num_authors'))
 }}}

 but if we try the one below, it does not find the column ''authors__count'
 to the aggregation

 {{{
 Entry.objects.annotate(Count('authors')).aggregate(Avg('authors__count'))
 }}}

 I believe it is a problem because the exception tells us we could use the
 column ''''authors__count''''

 This is what the exception says:

 '''FieldError: Cannot resolve keyword 'count' into field. Choices are:
 email, entry, id, name, authors__count''' <- see the field here.

 Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/24065>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.d2875badcd3d78c51c42b4dc0802d222%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to