From d5615411683bbfcc28d3b0db0ae36b3a82793c1b Mon Sep 17 00:00:00 2001 From: Charles Offenbacher Date: Thu, 12 Dec 2013 22:15:28 -0800 Subject: [PATCH] Adding the save_form_data method to SingleNode, fixing issue #228 --- neo4django/db/models/relationships.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neo4django/db/models/relationships.py b/neo4django/db/models/relationships.py index f736280..bedd2d5 100644 --- a/neo4django/db/models/relationships.py +++ b/neo4django/db/models/relationships.py @@ -499,6 +499,12 @@ def _save_relationship(self, instance, node, state): rels.single = self._create_neo_relationship(node, other) #other._save_neo4j_node(DEFAULT_DB_ALIAS) + def save_form_data(self, instance, data): + # TODO we need a function like _get_relationship that only takes a + # model instance... + state = self._state_for(instance) + self._set_relationship(instance, state, data) + def _set_cached_relationship(self, obj, other): state = BoundRelationship._state_for(obj) if self.name in state and state[self.name]: