Re: ManyToManyField.through for what?
On Sun, Jan 18, 2009 at 2:46 PM, Erik Bernoth wrote: > > Thanks very much. I see I have still other options where I can look > first: trac and unit tests. Will read all of that. :) Ideas and patches to enhance the documentation making this more straight forward to understand for the next person stumbling the same doubts are welcome 8) -- Ramiro Morales --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyToManyField.through for what?
On 18 Jan., 17:27, Ramiro Morales wrote: > On Sun, Jan 18, 2009 at 1:20 PM, Erik Bernoth wrote: > > > Hi guys, > > I'm trying to create a db model in Django. And until now I created n:m- > > Relations with own tables, because in many cases I need extra > > information like the creation date of that connection-entity. And now > > I found in the docs that it is possible to connect these individual > > n:m tables of myself with the foreign-key tables. But all together it > > does not look like I can do more with that .through attribute as I > > could without. > > Take a look at ticket #6095 to know the motivation and rationale behind > the addition of the through option and some of the advantages when > compared with using you own model with FKs to the two related models. > > Also and the documentation you pointed to modeltests/m2m_through tests > show the usage of the new API that allows you to do the same things you > were able to do but in a clearer way. > > Regards, > > -- > Ramiro Morales Thanks very much. I see I have still other options where I can look first: trac and unit tests. Will read all of that. :) --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyToManyField.through for what?
On Sun, Jan 18, 2009 at 1:20 PM, Erik Bernoth wrote: > > Hi guys, > I'm trying to create a db model in Django. And until now I created n:m- > Relations with own tables, because in many cases I need extra > information like the creation date of that connection-entity. And now > I found in the docs that it is possible to connect these individual > n:m tables of myself with the foreign-key tables. But all together it > does not look like I can do more with that .through attribute as I > could without. > Take a look at ticket #6095 to know the motivation and rationale behind the addition of the through option and some of the advantages when compared with using you own model with FKs to the two related models. Also and the documentation you pointed to modeltests/m2m_through tests show the usage of the new API that allows you to do the same things you were able to do but in a clearer way. Regards, -- Ramiro Morales --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ManyToManyField.through for what?
Hi guys, I'm trying to create a db model in Django. And until now I created n:m- Relations with own tables, because in many cases I need extra information like the creation date of that connection-entity. And now I found in the docs that it is possible to connect these individual n:m tables of myself with the foreign-key tables. But all together it does not look like I can do more with that .through attribute as I could without. I want to explain my question a little more in detail.For reference look here: http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships In this example a "Membership" Table is created like I created my own n:m-Tables. But than the following line is added to Group: members = models.ManyToManyField(Person, through='Membership') It looks like a violation to the DRY-Principle, to put this line there. What happens if I don't put this line in my code? I hope this is not an all day question... I couldn't find an answer in the docs and the mail group. kind regards Erik Bernoth --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---