Opened 4 months ago

Closed 4 months ago

#35608 closed Bug (needsinfo)

Regression: many-to-many fields are not being correctly persisted to db from the admin

Reported by: Adrian Capitanu Owned by:
Component: contrib.admin Version: 5.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adrian Capitanu)

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

Change History (3)

comment:1 by Adrian Capitanu, 4 months ago

Description: modified (diff)

comment:2 by Tim Graham, 4 months ago

Does this look like a server-side (wrong data in database) or a client-side issue (options not populating correctly)? Could you try to bisect the regression?

comment:3 by Sarah Boyce, 4 months ago

Resolution: needsinfo
Status: newclosed

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?
Note: See TracTickets for help on using tickets.
Back to Top