Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre_save hook for StructuredRel is broken #550

Open
knivets opened this issue Mar 17, 2021 · 2 comments
Open

pre_save hook for StructuredRel is broken #550

knivets opened this issue Mar 17, 2021 · 2 comments

Comments

@knivets
Copy link

knivets commented Mar 17, 2021

If a user adds a hook to their StructuredRel subclass model with the intention of populating some fields before the node gets saved, it won't work. The hook will fire and it will run the code that updates the fields, however after the node is saved the database will contain the pre-hook stage values. The reason is that the node instance that is passed to the hook is discarded after the hook has executed, I traced this problem to this code chunk. The params dict would hold the pre-hook stage values, and there is no way to influence this process for inside the hook.

I think being able to modify the actual object within a hook is important. I used a pre_save hook so I could implement the updated_at property that is updated each time an object is saved.

@knivets
Copy link
Author

knivets commented Jul 14, 2021

Hey! Are there any plans to fix this?

@whatSocks
Copy link
Collaborator

Hey @knivets we do plan to fix it, we are just limited in resources. I put this issue at the top of our 'to do' here:

https://github.com/neo4j-contrib/neomodel/projects/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants