#33769: F() expressions - OperationalError
-------------------------------+------------------------------------
Reporter: Pablo | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Carlton Gibson):
* cc: Mariusz Felisiak (added)
* component: Uncategorized => Documentation
* stage: Unreviewed => Accepted
Comment:
Given the docs at [https://docs.djangoproject.com/en/4.0/topics/db/queries
/#filters-can-reference-fields-on-the-model Filters can reference fields
on the model], I might expect this to work:
> You can also use the double underscore notation to span relationships in
an F() object. An F() object with a double underscore will introduce
> any joins needed to access the related object. For example, to retrieve
all the entries where the author’s name is the same as the blog name, we
could issue the query:
>
> `>>> Entry.objects.filter(authors__name=F('blog__name'))`
Nothing there to say it works with `__exact` but not `__in` — Questions:
Why not? What are the limitations here? And maybe, Why? 🤔 If it's not
supported OK, but can we document that better? Can we add Simon's ''Use a
subquery'' example as a note maybe?
I'll provisionally accept on that basis.
--
Ticket URL: <https://code.djangoproject.com/ticket/33769#comment:2>
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/0107018138471342-1e5097f6-2549-4e9e-ae07-a7bd055de191-000000%40eu-central-1.amazonses.com.