def save(self, *args, **kwargs):
        page_data = {}
        node_data = {}
        for fname, fvalue in self.cleaned_data.iteritems():
            if fname in self.node_field_names:
                node_data[fname] = fvalue
            else:
                page_data[fname] = fvalue

        if not self.instance.id:
            try:
                parent = FancyPage.objects.get(pk=self.parent_pk)
            except FancyPage.DoesNotExist:
                parent = None

            if parent:
                self.instance.node = parent.node.add_child(**node_data)
            else:
                self.instance.node = PageNode.add_root(**node_data)
        else:
            for key, value in node_data.iteritems():
                setattr(self.instance.node, key, value)
            self.instance.node.save()

        return super(PageNodeForm, self).save(*args, **kwargs)
dataset/ETHPy150Open tangentlabs/django-fancypages/fancypages/dashboard/forms.py/PageNodeForm.save/original