[Django] #25982: Djago ORM. Filter using multi-valued queryset

15 views
Skip to first unread message

Django

unread,
Dec 23, 2015, 5:45:19 PM12/23/15
to django-...@googlegroups.com
#25982: Djago ORM. Filter using multi-valued queryset
-------------------------------------+-------------------------------------
Reporter: FreddieFruitSticks | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 1.8
(models, ORM) | Keywords: mutli-value,
Severity: Normal | valuequeryset
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
As I understand it, and from the error I received, trying to filter based
on a multi-valued queryset cant be done (the error I received was
something like "cant filter using multi-valued querysets"). It is possible
that one may wish to filter based on a pair of values. Commutativity of
the tuples should be considered. Eg Filter the following:

Object.objects.values_list("v1","v2").filter(AnotherObject.objects.values_list("v1","v2"))

Eg,
[(1,2),(5,7),(3,8),(9,3)].filter ([(1,2),(3,9)]) = [(5,7),(3,8),(9,3)]

here (9,3) == (3,9) is false. Non-commutative

For commutative comparison we have Eg,

[(1,2),(5,7),(3,8),(9,3)].filter ([(1,2),(3,9)]) = [(5,7),(3,8)]

here (9,3) == (3,9) is true.

The non-commutative case was necessary in an example I had. I hacked it
where I created lists and compared using lists. However this requires a db
evaluation.

--
Ticket URL: <https://code.djangoproject.com/ticket/25982>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 23, 2015, 5:58:23 PM12/23/15
to django-...@googlegroups.com
#25982: Djago ORM. Filter using multi-valued queryset
-------------------------------------+-------------------------------------
Reporter: FreddieFruitSticks | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: mutli-value, | Triage Stage:
valuequeryset | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Could you refine the description with some actual models and sample code.
It's a bit unclear as is. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/25982#comment:1>

Django

unread,
Dec 24, 2015, 2:27:24 PM12/24/15
to django-...@googlegroups.com
#25982: Djago ORM. Filter using multi-valued queryset
-------------------------------------+-------------------------------------
Reporter: FreddieFruitSticks | Owner: nobody
Type: New feature | Status: closed

Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution: needsinfo

Keywords: mutli-value, | Triage Stage:
valuequeryset | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/25982#comment:2>

Reply all
Reply to author
Forward
0 new messages