* `add`
* `remove`
* `clear`
* `set`
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
--
Ticket URL: <https://code.djangoproject.com/ticket/34135>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Jon Janzen):
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)
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:1>
Old description:
> 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:
>
> * `add`
> * `remove`
> * `clear`
> * `set`
>
> 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
New description:
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:
* `add`
* `remove`
* `clear`
* `set`
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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:2>
* cc: Carlton Gibson (added)
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted
Comment:
Sounds reasonable.
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:3>
* owner: nobody => Jon Janzen
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:4>
Old description:
> 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:
>
> * `add`
> * `remove`
> * `clear`
> * `set`
>
New description:
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:5>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/16252 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:7>
Comment (by Bhuvnesh):
I would like to submit an improvement patch if not jon.
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:8>
Comment (by Mariusz Felisiak):
Replying to [comment:8 Bhuvnesh]:
> I would like to submit an improvement patch if not jon.
There is no need for a new patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:9>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"321ecb40f4da842926e1bc07e11df4aabe53ca4b" 321ecb40]:
{{{
#!CommitTicketReference repository=""
revision="321ecb40f4da842926e1bc07e11df4aabe53ca4b"
Fixed #34135 -- Added async-compatible interface to related managers.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34135#comment:11>