Opened 3 years ago
Last modified 3 years ago
#34135 closed New feature
Add async interface to ManyRelatedManager & RelatedManager — at Version 2
| Reported by: | Jon Janzen | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | async |
| Cc: | Carlton Gibson | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
With #34112 and #33646 combined, there is now an async interface for reading/writing Models in a lot of cases. One of the obvious places where that isn't true is in RelatedManager instances. RelatedManager instances are missing async versions of:
addremoveclearset
And this might be a separate ticket but the docs (1) are missing a reference to acreate which according to dir() exists on ManyRelatedManager (I assume as a consequence of inheriting from some superclass Manager type) but I didn't actually try and see if it works. I'm suspicious that it might not be fully correct as related_descriptors.py includes a possibly custom version of the synchronous create function (see (2) & (3)).
(1) https://docs.djangoproject.com/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager
(2) https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L788-L792
(3) https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1186-L1190
Change History (2)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
| Description: | modified (diff) |
|---|
FWIW I'm also willing to work on a PR for this ticket, assuming a similar solution to #34112.
(apologies if this ticket is not well-formed or I missed another ticket that covers the same topics)