Amazing, thanks. I just couldn't find the documentation to prove it one way or the other. I just didn't guess that anything would be different by default!
Much appreciated, Tim On Apr 25, 4:28 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Sat, Apr 25, 2009 at 6:26 PM, Tim Valenta > <tonightslasts...@gmail.com>wrote: > > > > > > > Hello all. I tried the IRC, but it's too chaotic and not enough > > people take you seriously :) > > > Very very abbreviated example code: > > > class Person(models.Model): > > parents = models.ManyToManyField('self', related_name='children') > > > Now, the exact relationship is just an example, but it demonstrates my > > problem. > > > Two things happen which don't seem to be normal. By "normal", I mean > > m2m relationships that relate to other models, and not "self". > > > 1) using the admin site, I make Persons A and B. A will be a parent, > > and B will be a child. So, I use the admin site to change B, > > selecting A as a parent. But now when I go to A's change form, it > > lists B in its selected 'parents' widget. That's completely contrary > > to my previous experience with the m2m relationship. Shouldn't A only > > list B when I access "children.all()" from A? > > > 2) But then that leads me to the second oddity. From the shell: > > >>> personA = Person.objects.get(pk=1) > > >>> personA.children.all() > > AttributeError: 'Person' object has no attribute 'children' > > > I've been practically cursing my laptop as I've been battling this > > issue. None of my other manytomany relationships (where models relate > > to *other* models, not to "self") on my site suffer from this problem. > > > Any direction at all would be immensely appreciated. > > > I'm using the latest django SVN update, Python 2.5.4, MySQL. > > > Thanks, > > Tim > > The issue is by default m2m relationships are symmetrical, you can change > this > though:http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod... > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---