Code

Opened 5 years ago

Closed 4 years ago

#11795 closed (fixed)

Allow use of inlines for many-to-many fields

Reported by: sveri Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords: manytomanyfield inline
Cc: miracle2k, Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by russellm)

When you try to create an inline field in admin.py for a manytomanyfield you always get the following error:
<class 'MyClass'> has no ForeignKey to <class 'OtherClass'>

It would be nice to be able to use inlines for many to many relations.

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

The documentation you reference refers to many-to-many models that use an intermediate table, not to m2m relations in general.

comment:2 Changed 5 years ago by sveri

Ok, thats true.
But is there a plan to support that for the future?
Should i open a feature request?

comment:3 Changed 5 years ago by russellm

  • Description modified (diff)
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from inline for many-to-many colmuns not working to Allow use of inlines for many-to-many fields

I'm not aware of any plans to add this feature. I've modified this ticket to reflect the feature request.

You may get your wish through a back channel. The changes required by #10109 will probably make this feature possible with no extra effort, as that ticket will require introducing a dummy model representation of m2m fields, and this dummy model may be compatible use in inlines. I plan to commit a fix for #10109 in the near future as a precursor to multiple-database and non-SQL backend support. I'll try to keep this ticket in mind before I commit.

comment:4 Changed 4 years ago by miracle2k

  • Cc miracle2k added

comment:5 Changed 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [11712]) Fixed #11795 -- Document (and slightly simplify) the use of inlines for m2m relations.

This is the first immediate benefit of m2m relations having an autogenerated model.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.