Can anybody explain me in a very simple aspects with a beautiful real world example the concept of signals and receiver . First of all the basic definition like what are they? I was going through the documentation of signals and receiver, but its a bit difficult to understand for a novice in django like me.
Share
Think of it like radio transmission.
A receiver is tuned to listen on a particular frequency (this is called “listening on a signal”).
Some other program transmits on that frequency (raising a signal, or emitting a signal).
The receiver only listens for those signals for which it is tuned to (receiver is run only when the signal it is listening to is emitted).
In django you can be the transmitter or the receiver. Django comes with a bunch of transmitters; and you write the receivers to listen on various frequencies.
A signal might be – “an object is saved”. So each piece of code that is listening on that signal will be executed when “an object is saved” signal is emitted.