#32007: QuerySet.annotate() with WhereNode() crashes with AttributeError.
-------------------------------------+-------------------------------------
     Reporter:  Gordon Wrigley       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Gordon Wrigley):

 Here is a more useful variant, this is a type thing I actually do on a
 regular basis, and I guess also means work won't be upgrading to 3.1 until
 I find a work around.

 {{{#!python
 Question.objects.annotate(
     pub_date__is_null=ExpressionWrapper(Q(pub_date=None),
 output_field=BooleanField())
 ).values("pub_date__is_null").annotate(
     id__count=Count("id", distinct=True)
 ).values("pub_date__is_null", "id__count")
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32007#comment:3>
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/065.01ebaad06f06613cc80ae8e2e540aeab%40djangoproject.com.

Reply via email to