#32414: Syntax Error when combining __in and F() in filter
-------------------------------------+-------------------------------------
     Reporter:  Douglas Franklin     |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  F()                  |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Douglas Franklin):

 The latter worked perfectly. Really interesting. Thank you! I agree
 though, seems like a practical use-case to have the special case when
 `get_prep_lookup` `F` refers to a many-to-many.

 The use of the through-table subquery is working for me, so it seems like
 an easy enough workaround.

 Replying to [comment:2 Simon Charette]:
 > Looks like you either want `attendees=F('profile')` or
 
`profile__in=CalendarEvent.attendees.through.objects.filter(calendarevent=OuterRef('pk')).values('profile')`.
 >
 > I guess we could raise a Python level error or adjust
 `RelatedIn.get_prep_lookup` special case `F` referring to many-to-many as
 well.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32414#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.ebd004738b230c6dd6b954d5ea89d9b9%40djangoproject.com.

Reply via email to