The way I think of the value of the "through" table approach is when
you want to attach information to the relationship that does not
belong on either model.
I like a band/musician example.
A person can be a part of many bands
A band has many people
so here we have a classic M2M
But a person
Thanks :)
On Oct 22, 5:52 pm, Tom Evans wrote:
> On Thu, 2009-10-22 at 07:57 -0700, Monika Sulik wrote:
> > Hi,
>
> > I was wondering what exactly are the advantages of having code like
> > this:
>
> > class Foo (models.Model):
> > bar_m2m =
On Thu, 2009-10-22 at 07:57 -0700, Monika Sulik wrote:
> Hi,
>
> I was wondering what exactly are the advantages of having code like
> this:
>
> >>
> class Foo (models.Model):
> bar_m2m = models.ManyToManyField(Bar,through='Foo_Bar')
>
> class Bar
Hi,
I was wondering what exactly are the advantages of having code like
this:
>>
class Foo (models.Model):
bar_m2m = models.ManyToManyField(Bar,through='Foo_Bar')
class Bar (models.Model):
pass
class Foo_Bar (models.Model):
foo = models.ForeignKey(Foo)
4 matches
Mail list logo