#32812: ORM issue with values_list named=True
-------------------------------------+-------------------------------------
               Reporter:  pirelle    |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Release    |       Keywords:
  blocker                            |
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Two same queries, but "named=True" in the end of second query throws
 exception

 {{{
 ipdb>
 Order.objects.prefetch_related("comments").annotate(orders_count=Count("pk",
 distinct=True)).values_list("delivery__delivery_method","orders_count")
 <QuerySet [(1124, 1), (None, 1), (None, 1), (None, 1), (None, 1), (None,
 1), (None, 1), (1125, 1), (None, 1), (None, 1), (None, 1), (1126, 1),
 (1127, 1), (1128, 1), (None, 1), (1129, 1), (1130, 1), (1131, 1), (1132,
 1), (1133, 1), '...(remaining elements truncated)...']>

 ipdb>
 Order.objects.prefetch_related("comments").annotate(orders_count=Count("pk",
 distinct=True)).values_list("delivery__delivery_method","orders_count",
 named=True)
 *** AttributeError: Cannot find 'comments' on Row object, 'comments' is an
 invalid parameter to prefetch_related()
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32812>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.590dfd8d9037eba540e092aca1b36538%40djangoproject.com.

Reply via email to