Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#9341 closed (fixed)

Adding a completely new item via raw_id_fields overwrites contents of the many-to-many field

Reported by: dhancock@… Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords: raw_id_fields many-to-many
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Steps to reproduce:

Define a many-to-many field, use raw_id_fields for the admin.
Populate the field in the admin with one or more IDs.
In the admin, click its magnifying glass.
Click Add on the index page, and add one.
Click Save.

You're automatically returned to the admin page with ONLY the new ID showing up in the field. This behavior is great for most foreign keys, but for many-to-many fields, it risks losing previous entries.

Change History (6)

comment:1 by adroffne@…, 16 years ago

This feature is working. I'll give an example based on my code.

I have a ManyToMany field with a defined through model class. It has a tabular Inline admin class using raw_id_fields. I see a separate form field for each relationship, as the primary key.

Next to every field is a magnifying glass to search and choose a primary key. The pop-up window looks like the admin change-list page. A click on a change-list item sets, or replaces, the raw id in the field.

In order to add more raw ids, the Inline admin class needs an extras=1, or more, attribute. That extras=N is probably all that's wrong.

comment:2 by Karen Tracey, 16 years ago

#10131 reports this again, and has a patch.

comment:3 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 by Jacob, 16 years ago

Resolution: fixed
Status: newclosed

(In [10452]) Fixed #9341: add another on ManyToManyFields with raw_id_admins now works correctly.

comment:5 by Jacob, 16 years ago

(In [10453]) [1.0.X] Fixed #9341: add another on ManyToManyFields with raw_id_admins now works correctly. Backport of r10452 from trunk.

comment:6 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top