[Django] #36194: add async support to ManyToManyField

15 views
Skip to first unread message

Django

unread,
Feb 16, 2025, 3:39:04 PM2/16/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
---------------------------------------+--------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: 5.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
---------------------------------------+--------------------------
hi
i'm working on an async version of `ModelForm` on a third party package
a problem that occurs is the lack of async support in mant to many fields
in particular,
[_save_m2m](https://github.com/django/django/blob/main/django/forms/models.py#L536)
calls
[save_form_data](https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010),
but there is no async equivalent to this mathod
even tho `save_form_data` is basically calling
[ManyRelatedManager.set](https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275)
which has an async equivalent

so i think adding an async version is a feasible option, ofc this means
adding async version of other methods of ManyToManyField that need one
so i'm volunteering for this
--
Ticket URL: <https://code.djangoproject.com/ticket/36194>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 16, 2025, 3:41:35 PM2/16/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by amirreza:

Old description:

> hi
> i'm working on an async version of `ModelForm` on a third party package
> a problem that occurs is the lack of async support in mant to many fields
> in particular,
> [_save_m2m](https://github.com/django/django/blob/main/django/forms/models.py#L536)
> calls
> [save_form_data](https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010),
> but there is no async equivalent to this mathod
> even tho `save_form_data` is basically calling
> [ManyRelatedManager.set](https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275)
> which has an async equivalent
>
> so i think adding an async version is a feasible option, ofc this means
> adding async version of other methods of ManyToManyField that need one
> so i'm volunteering for this

New description:

hi
i'm working on an async version of `ModelForm` on a third party package
a problem that occurs is the lack of async support in mant to many fields
in particular, `_save_m2m`
[https://github.com/django/django/blob/main/django/forms/models.py#L536]
calls `save_form_data`
[https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010],
but there is no async equivalent to this mathod
even tho `save_form_data` is basically calling `ManyRelatedManager.set`
[https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275]
which has an async equivalent

so i think adding an async version is a feasible option, ofc this means
adding async version of other methods of ManyToManyField that need one
so i'm volunteering for this

--
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:1>

Django

unread,
Feb 16, 2025, 3:42:09 PM2/16/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by amirreza:

Old description:

> hi
> i'm working on an async version of `ModelForm` on a third party package
> a problem that occurs is the lack of async support in mant to many fields
> in particular, `_save_m2m`
> [https://github.com/django/django/blob/main/django/forms/models.py#L536]
> calls `save_form_data`
> [https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010],
> but there is no async equivalent to this mathod
> even tho `save_form_data` is basically calling `ManyRelatedManager.set`
> [https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275]
> which has an async equivalent
>
> so i think adding an async version is a feasible option, ofc this means
> adding async version of other methods of ManyToManyField that need one
> so i'm volunteering for this

New description:

hi
i'm working on an async version of `ModelForm` on a third party package
a problem that occurs is the lack of async support in mant to many fields
in particular, `_save_m2m`
[https://github.com/django/django/blob/main/django/forms/models.py#L536]
calls `save_form_data`
[https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010],
but there is no async equivalent to this method
even tho `save_form_data` is basically calling `ManyRelatedManager.set`
[https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275]
which has an async equivalent

so i think adding an async version is a feasible option, ofc this means
adding async version of other methods of ManyToManyField that need one
so i'm volunteering for this

--
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:2>

Django

unread,
Feb 16, 2025, 3:45:45 PM2/16/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by amirreza:

Old description:

> hi
> i'm working on an async version of `ModelForm` on a third party package
> a problem that occurs is the lack of async support in mant to many fields
> in particular, `_save_m2m`
> [https://github.com/django/django/blob/main/django/forms/models.py#L536]
> calls `save_form_data`
> [https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010],
> but there is no async equivalent to this method
> even tho `save_form_data` is basically calling `ManyRelatedManager.set`
> [https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275]
> which has an async equivalent
>
> so i think adding an async version is a feasible option, ofc this means
> adding async version of other methods of ManyToManyField that need one
> so i'm volunteering for this

New description:

hi
i'm working on an async version of `ModelForm` on a third party package
a problem that occurs is the lack of async support in mant to many fields
in particular,
[https://github.com/django/django/blob/main/django/forms/models.py#L536
_save_m2m] calls
[https://github.com/django/django/blob/main/django/db/models/fields/related.py#L2010
save_form_data], but there is no async equivalent to this method
even tho `save_form_data` is basically calling
[https://github.com/django/django/blob/main/django/db/models/fields/related_descriptors.py#L1275
ManyRelatedManage.set()] which has an async equivalent

so i think adding an async version is a feasible option, ofc this means
adding async version of other methods of ManyToManyField that need one
so i'm volunteering for this

--
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:3>

Django

unread,
Feb 17, 2025, 3:39:18 AM2/17/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: closed
Component: Forms | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Sarah Boyce):

* resolution: => wontfix
* status: assigned => closed

Comment:

Thank you for the ticket!

So, we haven't built-out async support for forms (yet).
According to
[https://github.com/django/deps/blob/main/accepted/0009-async.rst#forms
DEP-9], we want to add async support for forms, and `ModelForm` in
particular.

The more recent conversation around whether
[https://forum.djangoproject.com/t/is-dep009-async-capable-django-still-
relevant/ DEP-9 is still relevant] discoraged async support being added to
"everything".
However, the components that were suggested as not worth the extra
maintenance cost were [https://forum.djangoproject.com/t/is-dep009-async-
capable-django-still-relevant/30132/2 Templates], and
[https://forum.djangoproject.com/t/is-dep009-async-capable-django-still-
relevant/30132/5 base admin views, the syndication framework, …]

So I believe we could change this ticket title to "Async support for
forms" and then can do multiple PRs to achieve this with `Refs #36194`

I know that you are only talking about `ManyToManyField` here, however
adding/updating the API to allow partial form support without discussing
the wider goal for Django (to me) is not ideal.

-------

With all new features, we want to discuss with the community as to whether
the change is desirable.

In this case, I will add a message to the existing discussion and if we
get a positive response (this can take a couple of weeks to assess), we
can then accept the ticket.
While we are understanding the ticket, it will be in the status "wontfix"
and will stay this way unless/until we come to an agreement to action it.

For more information, see
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features the documented guidelines for requesting
features].
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:4>

Django

unread,
Feb 17, 2025, 3:41:09 AM2/17/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: closed
Component: Forms | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Sarah Boyce):

* cc: Jon Janzen, Andrew Godwin (added)
* easy: 1 => 0

Comment:

Related #34135
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:5>

Django

unread,
Feb 17, 2025, 4:33:42 AM2/17/25
to django-...@googlegroups.com
#36194: add async support to ManyToManyField
-----------------------------+--------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: closed
Component: Forms | Version: 5.1
Severity: Normal | Resolution: wontfix
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 amirreza):

hi there👋
thanks for the response 🙏

ofc it needs to be discussed in the wider area of `Fields`
i mostly meant that i can promise a work on many to many field for now,
maybe i get a chance to work on more related subjects, but i don't want to
throw empty promises out there

i would also like to clarify that the mentioned `AsyncModelForm` is a
thrid party package, so this ticket is only about Fileds


so I'll wait until you reach a conclusion🙌
--
Ticket URL: <https://code.djangoproject.com/ticket/36194#comment:6>
Reply all
Reply to author
Forward
0 new messages