#25991: A new implementation for exclude() queries -------------------------------------+------------------------------------- Reporter: akaariai | Owner: nobody Type: Bug | Status: new Component: Database | Version: master layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: Accepted | Has patch: 1 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- The idea is to prewalk the Q-object, split it into parts that need to go into a subquery, and then add the filtered subqueries into the main query.
This ticket deals with problems of doing `Author.objects.exclude(friends__age__gte=20, friends__age__lte=40)`. Currently this creates two joins to friends, so that any author with either a friend older than 20 or a friend younger than 40 is matched. The correct interpretation is that any author with a friend with age between 20 and 40 is matched. -- Ticket URL: <https://code.djangoproject.com/ticket/25991> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.694b46dc08f2cceb801002271f403fbb%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.