This repository was archived by the owner on May 5, 2021. It is now read-only.
#43: Make the Hook model available for extension #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows to customize the Hook model locally, for example:
This PR is incomplete at the moment but it's a base for discussion.
Now that I can have my custom Hook model, I'm wondering about the best way it can be used in
find_and_fire_hook
https://github.com/zapier/django-rest-hooks/blob/master/rest_hooks/utils.py#L62 in place of the Hardcoded one.One approach could be a settings, default to
rest_hooks.models.Hook
Also, I'd like to be able to easily customized
find_and_fire_hook()
in general to craft the any filters relevant to my custom model.Using my previous example, I'd like to be able to do something like
Since I want control over the model and the filters, all we may need is a simple and clean way to extend/replace
find_and_fire_hook()
.Maybe a setting in the fashion of the current
HOOK_DELIVERER
one, usingfind_and_fire_hook()
by default, but could be override by a function/class that is responsible to return the list of hooks to be triggered.@avelis I'd like your thoughts on this :)