#17315: .exclude(a, b) does not operate on a single related record
----------------------------------------------+--------------------
Reporter: absoludity@… | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: SVN
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
I'm not sure if this is an implementation error, or a documentation error,
but according to the documentation for filter/exclude spanning multi-
valued relationships[1]:
"Everything inside a single filter() call is applied simultaneously to
filter out items matching all those requirements. Successive filter()
calls further restrict the set of objects, but for multi-valued relations,
they apply to any object linked to the primary model, not necessarily
those objects that were selected by an earlier filter() call."
"All of this behavior also applies to exclude(): all the conditions in a
single exclude() statement apply to a single instance (if those conditions
are talking about the same multi-valued relation)"
yet I can create a test [2] which seems to show this is not the case. The
filter seems to do the correct thing, but the .exclude() call applies
multiple args inside the call to separate instances [3]
[1] https://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-
multi-valued-relationships
[2] http://paste.ubuntu.com/754721/ which, when run, results in
http://paste.ubuntu.com/754723/
[3] http://paste.ubuntu.com/754742/
--
Ticket URL: <https://code.djangoproject.com/ticket/17315>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.