Signals are used to take action in response to the modification or creation of a database entry. Its utilities help us to connect events with their action. we can create methods that will run a signal when it is called. For example, as soon as a new user instance is generated in the Database, one might want to create a profile instance. Generally, There are 3 types of signals.
- pre_delete/post_delete: This signal is thrown before the remove() method is used to delete a model’s instance.
- pre_init/post_init: This signal is thrown before/after instantiating a model (__init__() method)
- pre_save/post_save: This signal works before/after the method save().
Leave a Reply