On 10/31/06, Vortexmind <[EMAIL PROTECTED]> wrote:
>
> Hi all
> I am currently developing a rather large data model, and I need to use
> Many-to-Many with Intermediate Table (as I need to stick some
> attributes within the association). I try to explain with the Django
> example about this issue:
>
> from django.db import models
>
> class Reporter(models.Model):
>     first_name = models.CharField(maxlength=30)
>     last_name = models.CharField(maxlength=30)
>
> class Article(models.Model):
>     headline = models.CharField(maxlength=100)
>     pub_date = models.DateField()
>
> class Writer(models.Model):
>     reporter = models.ForeignKey(Reporter)
>     article = models.ForeignKey(Article)
>     position = models.CharField(maxlength=100)
>
> So far, if i add
>
> class Admin:
>     pass
>
> to all the above I can edit them. But what if I want to have the inline
> admin to make the Writer relation when adding an Article or a Reporter?
> If I do as above, I must add Reporter, then Article, then I can finally
> go in the Writer admin interface and do the join. I hope you understand
> me :)

The admin application doesn't currently have any special handling for
m2m relations with intermediate tables, so the approach you describe
is the only way to do it.

The only way to do this would be to write your own view, and customize
the manipulator to represent m2m with intermediate tables.

That said, 'm2m with intermediate' is a relatively common use case, so
if you have any neat ideas on how to represent such a structure, feel
free to suggest them. The idea has been discussed before, but no
obvious solution has emerged (the real sticking point is querying the
intermediate table - check the archives for previous discussions).

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to