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)
bar = models.ForeignKey(Bar)
x = models.IntegerField()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
over having the same code, but having the Foo class like so:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
class Foo (models.Model):
pass
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
In both cases I can use foo.foo_bar_set and bar.foo_bar_set (assuming
foo is a Foo Object and bar is a Bar Object). Why would I need the
bar_m2m variable?
I'm probably missing something pretty obvious, but if someone could
point out the answer to me that would be great :)
Monika
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---