[Django] #35608: Regression: many-to-many fields are not being correctly persisted to db from the admin

10 views
Skip to first unread message

Django

unread,
Jul 16, 2024, 2:22:01 PM (yesterday) Jul 16
to django-...@googlegroups.com
#35608: Regression: many-to-many fields are not being correctly persisted to db
from the admin
----------------------------+-----------------------------------------
Reporter: captain828 | Type: Bug
Status: new | Component: contrib.admin
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+-----------------------------------------
**Prerequisites:**
- database: postgres16
- settings.py file that points to it
- have new connection pooling configured
- have a model that has a m2m field
- register that model to admin
- create a couple of instances to use in the m2m relationship

**Steps to repro:**
1. via admin, on a model with an m2m field, create a new model instance
with no m2m relationships and save
2. edit the same instance, adding extra m2m relationships and save
3. re-open the same instance and observe m2m field

**Expected result:**
The m2m field should have the options selected at (2) if the save was
successful.

**Current result:**
The m2m field does not have some or all the options selected at (2),
despite the save being successful.

**Affected Versions:** 5.1b1

**Working Versions:** 5.0.7
--
Ticket URL: <https://code.djangoproject.com/ticket/35608>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 16, 2024, 2:29:16 PM (yesterday) Jul 16
to django-...@googlegroups.com
#35608: Regression: many-to-many fields are not being correctly persisted to db
from the admin
-------------------------------+--------------------------------------
Reporter: captain828 | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | 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: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by captain828:

Old description:

> **Prerequisites:**
> - database: postgres16
> - settings.py file that points to it
> - have new connection pooling configured
> - have a model that has a m2m field
> - register that model to admin
> - create a couple of instances to use in the m2m relationship
>
> **Steps to repro:**
> 1. via admin, on a model with an m2m field, create a new model instance
> with no m2m relationships and save
> 2. edit the same instance, adding extra m2m relationships and save
> 3. re-open the same instance and observe m2m field
>
> **Expected result:**
> The m2m field should have the options selected at (2) if the save was
> successful.
>
> **Current result:**
> The m2m field does not have some or all the options selected at (2),
> despite the save being successful.
>
> **Affected Versions:** 5.1b1
>
> **Working Versions:** 5.0.7

New description:

**Prerequisites:**
- database: postgres16
- settings.py file that points to it
- have new connection pooling configured
- have a model that has a m2m field
- register that model to admin
- create a couple of instances to use in the m2m relationship

**Steps to repro:**
1. via admin, on a model with an m2m field, create a new model instance
with no m2m relationships and save
2. edit the same instance, adding extra m2m relationships and save
3. re-open the same instance and observe m2m field

**Repro rate:**
- inconsistent
- maybe related to connection pooling?

**Expected result:**
The m2m field should have the options selected at (2) if the save was
successful.

**Current result:**
The m2m field does not have some or all the options selected at (2),
despite the save being successful.

**Affected Versions:** 5.1b1

**Working Versions:** 5.0.7

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

Django

unread,
Jul 16, 2024, 3:05:57 PM (yesterday) Jul 16
to django-...@googlegroups.com
#35608: Regression: many-to-many fields are not being correctly persisted to db
from the admin
-------------------------------+--------------------------------------
Reporter: captain828 | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | 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: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Tim Graham):

Does this look like a server-side (wrong data in database) or a client-
side issue (options not populating correctly)? Could you try to
[https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
tickets/#bisecting-a-regression bisect the regression]?
--
Ticket URL: <https://code.djangoproject.com/ticket/35608#comment:2>

Django

unread,
4:20 AM (15 hours ago) 4:20 AM
to django-...@googlegroups.com
#35608: Regression: many-to-many fields are not being correctly persisted to db
from the admin
---------------------------------+--------------------------------------
Reporter: Adrian Capitanu | Owner: (none)
Type: Bug | Status: closed
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution: needsinfo
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):

* resolution: => needsinfo
* status: new => closed

Comment:

Hi Adrian, I appreciate you have said this is inconsistent, I am
struggling to replicate.
I have tested using a Postgres connection pool (`"pool": True`) using
5.1b1 using a model with a m2m field registered in the admin.
I have tried to see if I can find issues client side (interacting with the
plus widget, Firefox/Chrome/Edge, mobile view) but no joy.

Looking into Tims suggestions would really help.

Also you can share extra info such as
- how have you setup the connection pool
- the admin and model (in case it's a different widget for example)
- you said downgrading to 5.0.7 works (I assume this has no connection
pool), does using 5.1b1 without a connection pool have this behaviour?
--
Ticket URL: <https://code.djangoproject.com/ticket/35608#comment:3>
Reply all
Reply to author
Forward
0 new messages