Changes between Initial Version and Version 1 of Ticket #37300, comment 3


Ignore:
Timestamp:
Aug 26, 2026, 5:46:05 PM (3 weeks ago)
Author:
Yassin Bahri

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37300, comment 3

    initial v1  
    1 I reproduced this on current main and opened PR: https://github.com/django/django/pull/21828
     1I reproduced this regression locally and prepared a patch with regression tests.
    22
    3 The regression happens for both custom forward FK prefetch querysets and custom reverse O2O prefetch querysets. In both cases, the custom queryset no longer receives the parent instance hint, so routers can choose the wrong database.
    4 
    5 The PR restores `_add_hints(instance=instances[0])` in both descriptor paths and adds multi-database regression tests for `Book.editor` and `User.userprofile`.
    6 
    7 Locally tested with:
     3The patch restores the missing routing hint for custom Prefetch querysets in the forward ForeignKey and reverse OneToOne descriptor paths. With PYTHONPATH pointed at the checkout, the multiple_database test suite passes:
    84
    95{{{
    10 python tests/runtests.py multiple_database --verbosity 1
     6PYTHONPATH=. python tests/runtests.py multiple_database --verbosity 1 --parallel 1
    117}}}
     8
     9The PR was auto-closed because the ticket is still Unreviewed. Could a triager please review whether this should be marked Accepted? Once accepted and assigned, I can reopen or recreate the PR.
Back to Top