On Sun, Jun 15, 2008 at 12:12 PM, Jason <[EMAIL PROTECTED]> wrote:
>
> Sorry if this has been addressed-- having trouble figuring out how to
> search for this issue.
>
> Basically, I'd like to be able to edit many-to-many relationships from
> both admin screen, so if "articles" has a mtm relationship
> w/"categories", I can see both which categories are attached to
> articles from the article admin screen, AND which articles are
> attached to the category from the categories admin screen.
>
> Saw some talk of putting ManyToManyFields in both classes, & then
> forcing the db_table name to be the same, but sounded kinda
> unorthodoxy & early reports were that it didn't work anyway.  Any
> ideas?

You don't need to fix it at the model level - the model will contain
all the information that is required. What you need to fix is at the
form level.

In the forward direction, a newforms ModelForm will include a widget
for the m2m relationship.

The reverse direction is a little more difficult. At present, there
isn't a way to get a ModelForm to automatically include a widget for
the 'reverse' m2m relationship. However, if you have used ModelForm to
build the form for your model, you can manually add a
newforms.models.ModelMultipleChoiceField that represents the reverse
relation.

If you need to do this using oldforms, or on trunk admin - you're on
your own. Customization of the trunk admin interface is somewhat
difficult, which is one of the many very good reasons that we're in
the process of replacing trunk admin with a version based on newforms.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to