Re: [Django] #35974: Use router.allow_relation in RelatedManager.add and GenericRelatedObjectManager.add (was: create_reverse_many_to_one_manager: use router.allow_relation instead of comparing objects' _state.db in RelatedManager.add)

4 views
Skip to first unread message

Django

unread,
Dec 6, 2024, 3:39:09 AM12/6/24
to django-...@googlegroups.com
#35974: Use router.allow_relation in RelatedManager.add and
GenericRelatedObjectManager.add
-------------------------------------+-------------------------------------
Reporter: Laurent Szyster | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* cc: Tim Graham (added)
* stage: Unreviewed => Accepted
* summary:
create_reverse_many_to_one_manager: use router.allow_relation instead
of comparing objects' _state.db in RelatedManager.add
=>
Use router.allow_relation in RelatedManager.add and
GenericRelatedObjectManager.add

Comment:

Thank you for the report Laurent
Been looking into it and this is also the case for
`GenericRelatedObjectManager` and I think the logic was added in #18556
(see also this [https://code.djangoproject.com/ticket/18556#comment:8
comment]).
This is not something I am very familiar with but what you're saying
sounds reasonable and I would be happy to see a patch with tests -
tentatively accepting
--
Ticket URL: <https://code.djangoproject.com/ticket/35974#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages