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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to