Open attilamester opened 2 years ago
I ran the following code in 4.0.8.
class RelA(StructuredRel):
def pre_save(self):
print("relation pre_save")
def post_save(self):
print("relation post_save")
class NodeA(StructuredNode):
b = RelationshipTo("NodeB", "SOME_REL", model=RelA)
def pre_save(self):
print("node pre_save")
def post_save(self):
print("node post_save")
def pre_delete(self):
print("node pre_delete")
def post_delete(self):
print("node post_delete")
def post_create(self):
print("node post_create")
class NodeB(StructuredNode):
pass
a = NodeA().save()
a.b.connect(NodeB().save())
a.delete()
Output:
node pre_save
node post_create
node post_save
relation pre_save
relation post_save
node pre_delete
node post_delete
All hooks works well.
get_or_create()
and create_or_update()
do not invoke post_create
. https://neomodel.readthedocs.io/en/latest/hooks.html
Changed the title to your actual problem. Wouldn't know if this is by design, or something to add. Do you have an idea @a-takahashi223 ?
I ran the test because the original title "Some hooks are only available using django_neomodel (pre_save, post_save, pre_delete, post_delete)" is concerned. I don't know about django_neomodel or create_or_update. Sorry.
Hi! In neomodel==4.0.8,
create_or_update
does not call thepost_save
hook. Is this by design intended? Thanks!