Lachlan,
Not sure if I grokked your problem exactly, but just from personal
experience when I found my brain turned to jelly with a similar-sounding
issue before, I believe I found the answer in the "symmetrical=False"
option .. I do believe setting symmetrical=False for your 'parents' and
'children' fields maybe a good first step toward figuring this out -- I did
find that automatic creation of symmetrical relations in this case to be a
bit confusing if you aren't expecting it. And, also, just thinking about it
-- do you actually need two separate fields for parents and children? Why
not just --
children = models.ManyToManyField("self", related_name='parents',
verbose_name="Children",
symmetrical=False, null=True, blank=True)
Tbh, still not sure why your above example did not work:
>>> bob = Account(first_name="bob",last_name="sanders",gender='M')
>>> sarah = Account(first_name="sarah",last_name="sanders",gender='F')
>>> bob.siblings.add(sarah)
This is not something silly like needing to call bob.save() and
sarah.save() before adding the m2m, is it ?
Any-how, um, not sure if that helps at all or adds to the confusion, just
that I remember experiencing some brain-jelly and at that point, grokking
the 'symmetrical=False' option was my way out of it .. not sure if that's
your problem, though :-)
Cheers and all the best,
Sanjay
On Thu, Apr 11, 2013 at 12:31 PM, Lachlan Musicman <[email protected]>wrote:
> I tried reading the code in django/db/models/fields/related.py but
> quickly realised it was beyond me groking in a half hour.
>
> BUT, for some reason I felt compelled to test through the admin
> interface and it is working. ie, I can create and remove siblings and
> partners from each other, error free (seemingly, anyway).
>
> So, confusion level ++
>
> L.
>
> --
> The new creativity is pointing, not making. Likewise, in the future,
> the best writers will be the best information managers.
>
>
> http://www.theawl.com/2013/02/an-interview-with-avant-garde-poet-kenneth-goldsmith
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.