graphene-django-cud
graphene-django-cud copied to clipboard
feat: Ensure that before_save always occurs before a save
trafficstars
We've noticed that in some of the mutations, the before_save trigger actually happens after save. This PR request has a proposed refactor:
Changes:
- Ensure that the
before_savefunction always takes place before save. - Refactor the code so that the
before_savefunction takes a consistent set of parameters (currently it sometimes takes a query set and sometimes an object) and always returns a consistent value (the object that will be created, updated, or deleted). Note: this is a backward-incompatible change but was needed to achieve our implementation of the first item.
Still to-do:
- Write tests that ensure before_save happens before.
@tOgg1 - Curious about your feedback on this one or if you think there's a better approach?
Hi @keithhackbarth!
Thanks!
I'll get on checking this before the end of the week.
Closing this until the issues are resolved.