Opened 10 years ago

Last modified 8 years ago

#23604 closed Bug

Regression in allowing to handle M2M fields from the "receiving end" - follow up to #23329 — at Version 2

Reported by: Emmanuelle Delescolle Owned by: nobody
Component: contrib.admin Version: 1.7
Severity: Release blocker Keywords: to_field_allowed, M2M
Cc: Simon Charette Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Emmanuelle Delescolle)

Up until Django 1.5.8 and Django 1.6.5 it was possible to have a ManyToMany field displayed in the admin on the "receiving-end" of the relationship with the ability to add new records.
Due to the restrictiveness of the new to_field_allowed method, one cannot open the popup for adding new records to the Model where the ManyToMany relationship is defined.

I realize this usage of the admin site is undocumented but, since the current code allows to perform that from the "receiving-end" of ForeignKey fields, IMHO it should also work for ManyToMany fields.

If the descriptions sounds too vague, see http://www.lasolution.be/blog/related-manytomanyfield-django-admin-site.html for a complete step-by-step explanation on how to reproduce.

Change History (4)

by Emmanuelle Delescolle, 10 years ago

Attachment: failing_test.patch added

Failing test (patch for master)

by Emmanuelle Delescolle, 10 years ago

Attachment: fix.patch added

Fix

comment:1 by Emmanuelle Delescolle, 10 years ago

If this is approved I'll create pull requests for 1.6, 1.7 and master

comment:2 by Emmanuelle Delescolle, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top