#9341 closed (fixed)
Adding a completely new item via raw_id_fields overwrites contents of the many-to-many field
Reported by: | 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 , 16 years ago
comment:3 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
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.