Re: Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-24 Thread Preston Holmes
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

Re: Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-23 Thread Monika Sulik
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 =

Re: Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-22 Thread Tom Evans
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

Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-22 Thread Monika Sulik
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)