-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Signals | ||
|
||
Signals allow certain senders to inform a set of receivers that specific actions have occurred. So a component could be able to send notification to another in a decoupled manner, minimising dependence between two or more components. | ||
|
||
We use the Django signals dispatcher module to have signals in Taiga. | ||
|
||
You can find more info at [Django Documentation - Signals](https://docs.djangoproject.com/en/dev/topics/signals/) | ||
|
||
|
||
## How to implement Signals? | ||
|
||
First, we define some elements: | ||
|
||
- **Signal**: An object used to notify a particular event. | ||
- **Sender**: An object that sends the signal. | ||
- **Receiver**: A function that will be executed when a signal is dispatched. | ||
|
||
So, the steps to use a predefined signal are: | ||
|
||
1. Slect a predefinend signal | ||
2. Define one or more receivers | ||
3. Connect the receivers with their sender | ||
|
||
Predefined signals are related to the ORM Model: pre_save, post_save, pre_delete, post_delete and m2m_changed are some of then. You can find a complete and detailed list in the [Django Documentation about predefined signals](https://docs.djangoproject.com/en/dev/ref/signals/). | ||
|
||
If we want to use a custom signal, we follow this steps: | ||
|
||
1. Define a signal. | ||
2. Define one or more receivers. | ||
3. Connect the receivers with their sender. | ||
4. Send signals from any component. |