#22503: Inconsistent behavior when a QuerySet is sliced
-------------------------------------+-------------------------------------
Reporter: ajaest | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 1.6
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: QuerySet, filter, | Needs documentation: 0
slice | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by jorgecarleitao):
I will map the discussion in the thread to here: I believe the consensus
was that this cannot be done:
Assume `other_method_somewhere` uses a filter. The sequence would be
{{{
queryset.filter(first_clause)[:10].filter(second_clause)
}}}
Most people would assume (as pointed out in the thread) that the second
clause would be applied to the last 10 entries, when it is not. Doing that
is not possible in SQL without
subqueries and thus we explicitly forbid it.
--
Ticket URL: <https://code.djangoproject.com/ticket/22503#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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.488cb3f9854da8250b9d2d7e0cf98ce2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.