[Django] #11795: inline for many-to-many colmuns not working

0 views
Skip to first unread message

Django

unread,
Aug 28, 2009, 4:57:27 AM8/28/09
to djang...@holovaty.com, django-...@googlegroups.com
#11795: inline for many-to-many colmuns not working
------------------------------------+---------------------------------------
Reporter: sveri | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.1
Keywords: manytomanyfield inline | Stage: Unreviewed
Has_patch: 0 |
------------------------------------+---------------------------------------
When i try to create an inline field in admin.py for a manytomanyfield i
always get the following error:
<class 'politlog.app.models.Class'> has no ForeignKey to <class
'politlog.otherapp.models.OtherClass'>

It seems like django doesnt support inlines for ManyToManyFields whereas
the documentation says otherwise:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#working-with-many-
to-many-intermediary-models

I've described my problem also here:
http://groups.google.de/group/django-
users/browse_thread/thread/4586689cbbc07a28/2a1efa4882fcfc67?lnk=gst&q=many+to+many#2a1efa4882fcfc67

--
Ticket URL: <http://code.djangoproject.com/ticket/11795>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 28, 2009, 5:45:43 AM8/28/09
to djang...@holovaty.com, django-...@googlegroups.com
#11795: inline for many-to-many colmuns not working
------------------------------------+---------------------------------------
Reporter: sveri | Owner: nobody
Status: closed | Milestone:
Component: Uncategorized | Version: 1.1
Resolution: invalid | Keywords: manytomanyfield inline
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by russellm):

* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0

Comment:

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

--
Ticket URL: <http://code.djangoproject.com/ticket/11795#comment:1>

Django

unread,
Aug 28, 2009, 6:17:01 AM8/28/09
to djang...@holovaty.com, django-...@googlegroups.com
#11795: inline for many-to-many colmuns not working
------------------------------------+---------------------------------------
Reporter: sveri | Owner: nobody
Status: closed | Milestone:
Component: Uncategorized | Version: 1.1
Resolution: invalid | Keywords: manytomanyfield inline
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by sveri):

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

--
Ticket URL: <http://code.djangoproject.com/ticket/11795#comment:2>

Django

unread,
Aug 28, 2009, 8:03:19 AM8/28/09
to djang...@holovaty.com, django-...@googlegroups.com
#11795: Allow use of inlines for many-to-many fields
------------------------------------+---------------------------------------
Reporter: sveri | Owner: nobody
Status: reopened | Milestone:
Component: Uncategorized | Version: 1.1
Resolution: | Keywords: manytomanyfield inline
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by russellm):

* status: closed => reopened
* resolution: invalid =>
* summary: inline for many-to-many colmuns not working => Allow use of
inlines for many-to-many fields

Old description:

> When i try to create an inline field in admin.py for a manytomanyfield i
> always get the following error:
> <class 'politlog.app.models.Class'> has no ForeignKey to <class
> 'politlog.otherapp.models.OtherClass'>
>
> It seems like django doesnt support inlines for ManyToManyFields whereas
> the documentation says otherwise:
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#working-with-
> many-to-many-intermediary-models
>
> I've described my problem also here:
> http://groups.google.de/group/django-
> users/browse_thread/thread/4586689cbbc07a28/2a1efa4882fcfc67?lnk=gst&q=many+to+many#2a1efa4882fcfc67

New description:

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.

Comment:

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.

--
Ticket URL: <http://code.djangoproject.com/ticket/11795#comment:3>

Django

unread,
Nov 2, 2009, 1:42:24 PM11/2/09
to djang...@holovaty.com, django-...@googlegroups.com
#11795: Allow use of inlines for many-to-many fields
------------------------------------+---------------------------------------
Reporter: sveri | Owner: nobody
Status: reopened | Milestone:
Component: Uncategorized | Version: 1.1
Resolution: | Keywords: manytomanyfield inline
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by miracle2k):

* cc: miracle2k (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/11795#comment:4>
Reply all
Reply to author
Forward
0 new messages