Login

Tag "signal-connect"

Snippet List

"Autoconnect" model decorator, easy pre_save and post_save signal connection

This method allows you to define pre_save and post_save signal connections for your decorators in a little more clean way. Instead of calling `pre_save.connect(some_func, sender=MyModel)`, or perhaps `pre_save.connect(MyModel.some_static_func, sender=MyModel)`, you can simply define the pre_save method right on your model. The @autoconnect decorator will look for pre_save and post_save methods, and will convert them to static methods, with "self" being the instance of the model.

  • pre_save
  • post_save
  • signal-connect
Read More

1 snippet posted so far.