#31420: Using SimpleLazyObject with a nested subquery annotation fails.
-------------------------------------+-------------------------------------
     Reporter:  Jordan Ephron        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:  simplelazyobject,    |             Triage Stage:  Accepted
  queryset, subquery                 |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * cc: Simon Charette (added)
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 I agree that this behavior was changed in
 35431298226165986ad07e91f9d3aca721ff38ec, but you can easily create a test
 with `SimpleLazyObject()` (which is not a public API) and `Subquery()`
 that always fails with `TypeError`, e.g.
 {{{
 def test_subquery_filter_by_lazy(self):
     test_user = SimpleLazyObject(lambda:
 get_user_model().objects.get(username='test'))
     qs = Company.objects.annotate(
 
related=Subquery(Employee.objects.filter(lastname=OuterRef('ceo__lastname')).values('user')),
     ).filter(related=test_user)
     self.assertEqual(qs.get(), self.foobar_ltd)
 }}}
 This is somehow related with nested subqueries.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31420#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.9fefb2027ae24cfedad79f51408ed361%40djangoproject.com.

Reply via email to