django-mptt/django-mptt — pull request #181 by dekkers (2012-04-22 00:55:17+00:00)
Title: Update the mptt fields in the cached parent when saving existing object

We didn't update the parent mptt fields when saving an existing object like we do when creating it, resulting in that this worked as expected:
```python
parent = Node.objects.create()
child = Node.objects.create(parent=parent)
parent.get_children()
```
but this didn't:
```python
parent = Node.objects.create()
child = Node.objects.create()
child.parent = parent
child.save()
parent.get_children()
```

This patch checks whether we are already a descendant of the new parent and updates the mptt fields in the cached parent if we aren't. I've also added checks for this to the reparenting test cases.