Home

Awesome

django-hooks

Build Status Coverage Status pypi licence

A modular plugin system for django apps.

There are 3 kinds of hooks:

Why?

Let's say we want to render contextual information beside a record allocated in my_main_app. This extra information can be provided by some third-party application: Notes, Attachments, Comments, Followers, etc.

Adding an {% include %} tag to our my_record.html is not possible because we don't know what to render beforehand (a note? a list of comments?) or even if any of those applications are installed for our case/customer/project.

We can create a TemplateHook {% hook 'my_contextual_info' %} where we delegate the rendering and content retrieval to the hooked app(s). By doing so, my_record.html doesn't need to be touched anymore, no need to add more templatetags to {% load %} and we also make it easily reusable.

Compatibility

Documentation

Read The Docs

License

MIT