| | 6 | |
| | 7 | == Built-In Signals == |
| | 8 | |
| | 9 | Django has the following build in signalers: |
| | 10 | |
| | 11 | * class_prepared |
| | 12 | * pre_init |
| | 13 | * post_init |
| | 14 | * pre_save |
| | 15 | * post_save |
| | 16 | * pre_delete |
| | 17 | * post_delete |
| | 18 | * post_syncdb |
| | 19 | |
| | 20 | All the above are related to classes in your models.py files. |
| | 21 | |
| | 22 | == Custom Signals == |
| | 23 | |
| | 24 | You can send custom signals from the dispatcher, as well. In the following example from [http://feh.holsman.net/articles/2006/06/13/django-signals this intro to signals], a signal called "object_viewed" is sent whenever the following bit is called: |
| | 25 | |
| | 26 | {{{ |
| | 27 | dispatcher.send(signal=signals.object_viewed, request=request, object=object) |
| | 28 | }}} |