步骤:
1.定义一个信号:>>> from django.dispatch import Signal>>> custom_signal = Signal()>>>
2.为信号添加回调函数:
>>> def my_callback(sender, **more):... print 'my callback called'...>>> custom_signal.connect(my_callback)>>>
3.实际调用
>>> class Demo:... pass...>>> custom_signal.send(sender=Demo)my callback called[(, None)]>>>