#34612: QuerySet.only() doesn't work with select_related() on a reverse OneToOneField relation. -------------------------------------+------------------------------------- Reporter: Ian Cubitt | Owner: Simon | Charette Type: Bug | Status: closed Component: Database layer | Version: 4.2 (models, ORM) | Severity: Release blocker | Resolution: fixed Keywords: | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by nessita <124304+nessita@…>):
In [changeset:"83f5478225588f31e7cbbfed63a4a2b936abc03f" 83f54782]: {{{#!CommitTicketReference repository="" revision="83f5478225588f31e7cbbfed63a4a2b936abc03f" Fixed #35356 -- Deferred self-referential foreign key fields adequately. While refs #34612 surfaced issues with reverse one-to-one fields deferrals, it missed that switching to storing remote fields would break self-referential relationships. This change switches to storing related objects in the select mask instead of remote fields to prevent collisions when dealing with self-referential relationships that might have a different directional mask. Despite fixing #21204 introduced a crash under some self-referential deferral conditions, it was simply not working even before that as it aggregated the sets of deferred fields by model. Thanks Joshua van Besouw for the report and Mariusz Felisiak for the review. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/34612#comment:7> 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/0107018f0bbf636f-e92f379a-d589-4c7a-833d-c42076fe440c-000000%40eu-central-1.amazonses.com.