Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nitely/django-hooks
:anchor: A modular plugin system for Django
https://github.com/nitely/django-hooks
django hooks party-apps plugins python
Last synced: 18 days ago
JSON representation
:anchor: A modular plugin system for Django
- Host: GitHub
- URL: https://github.com/nitely/django-hooks
- Owner: nitely
- License: mit
- Created: 2014-07-21T15:27:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-22T03:24:19.000Z (over 8 years ago)
- Last Synced: 2024-10-12T07:14:16.897Z (about 1 month ago)
- Topics: django, hooks, party-apps, plugins, python
- Language: Python
- Homepage: http://django-hooks.readthedocs.org
- Size: 77.1 KB
- Stars: 16
- Watchers: 6
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# django-hooks
[![Build Status](https://img.shields.io/travis/nitely/django-hooks.svg?style=flat-square)](https://travis-ci.org/nitely/django-hooks)
[![Coverage Status](https://img.shields.io/coveralls/nitely/django-hooks.svg?style=flat-square)](https://coveralls.io/r/nitely/django-hooks)
[![pypi](https://img.shields.io/pypi/v/django-hooks.svg?style=flat-square)](https://pypi.python.org/pypi/django-hooks)
[![licence](https://img.shields.io/pypi/l/django-hooks.svg?style=flat-square)](https://raw.githubusercontent.com/nitely/django-hooks/master/LICENSE)A modular plugin system for django apps.
There are 3 kinds of hooks:
* TemplateHook: Third-party apps will be able to insert their own code (text/html) into an app template.
* FormHook: Third-party apps will be able to insert Forms in an app view.
* ~~ViewHook~~: This is deprecated in favor of `FormHook`
* SignalHook: Connect or emit a signal by its name/id. This is the same as Django signals
except that they don't need to be pre-defined.## 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
* Django 1.8 LTS; Python 2.7, 3.4 or 3.5
## Documentation
[Read The Docs](http://django-hooks.readthedocs.org/en/latest/)
## License
MIT