#35677: Unexpected behaviour of Prefetch with queryset filtering on a through model -------------------------------------+------------------------------------- Reporter: David Glenck | Owner: (none) Type: Bug | Status: new Component: Database layer | Version: 5.1 (models, ORM) | Severity: Normal | Resolution: Keywords: Prefetch, | Triage Stage: Accepted prefetch_related, many-to-many | Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Natalia Bidart):
Replying to [comment:4 Simon Charette]: > All in all this whole ''sticky'' notion is kind of ''hacky'' and simply doesn't appear appropriate in the context of `ManyRelatedManager.get_prefetch_querysets` (as there is no follow up `filter` call). It seems that we need in there is not `_next_is_sticky` but a way to let the ORM know that some filter calls against multi-valued relationships should reuse existing JOINs no matter what. I know we have a ticket for that but I can't find it. Simon, perhaps this is the ticket you are looking for? #27303, at first it seems like an admin specific report but reading on it feels it has some similarities with the "sticky" bits. Also thank you for your further analysis and reopening. -- Ticket URL: <https://code.djangoproject.com/ticket/35677#comment:6> 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107019156861c56-3eb583d1-34d7-4ae8-a406-0bd10272e631-000000%40eu-central-1.amazonses.com.