#35974: create_reverse_many_to_one_manager: use router.allow_relation instead of
comparing objects' _state.db in RelatedManager.add
-------------------------------------+-------------------------------------
Reporter: Laurent Szyster | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Laurent Szyster):
Note that the database router's `allow_relation` method is used elsewhere
to test if two objects can be related:
-
https://github.com/django/django/blob/39cf3c63f3228a04f101f3e62c75a6aae7c6ef0f/django/db/models/fields/related_descriptors.py#L284
-
https://github.com/django/django/blob/39cf3c63f3228a04f101f3e62c75a6aae7c6ef0f/django/db/models/fields/related_descriptors.py#L547
-
https://github.com/django/django/blob/39cf3c63f3228a04f101f3e62c75a6aae7c6ef0f/django/db/models/fields/related_descriptors.py#L1312
--
Ticket URL: <https://code.djangoproject.com/ticket/35974#comment:1>
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019396b42cd2-477636f2-820e-4779-a6ca-7bf0ce3bb055-000000%40eu-central-1.amazonses.com.