#20250: AttributeError when filtering annotated queryset with negated Q (via fk)
-------------------------------------+-------------------------------------
     Reporter:  jan.koutny@…         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:  fixed
     Severity:  Normal               |             Triage Stage:
     Keywords:  annotate             |  Unreviewed
  AttributeError                     |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => fixed
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 This seems to work on master. The results of the print qst.query are:
 {{{
 SELECT "tester_m1"."id", "tester_m1"."rtom3_id", "tester_m1"."x",
 COUNT("tester_m2"."id") AS "m2__count"
 FROM "tester_m1" INNER JOIN "tester_m3" ON ( "tester_m1"."rtom3_id" =
 "tester_m3"."id" )
 LEFT OUTER JOIN "tester_m2" ON ( "tester_m1"."id" = "tester_m2"."rtom1_id"
 )
 WHERE NOT ("tester_m3"."x" = 0 ) GROUP BY "tester_m1"."id",
 "tester_m1"."rtom3_id", "tester_m1"."x"
 }}}
 I haven't verified that the generated query is correct, but at least no
 errors are thrown.

 Backpatching this to 1.4 will not happen as this isn't a critical bug (not
 a dataloss/security/regression/crash bug). I am marking this as fixed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20250#comment:1>
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to