Skip to content

Instantly share code, notes, and snippets.

@ilya-muhortov
Last active September 30, 2019 06:35
Show Gist options
  • Save ilya-muhortov/b5996085e368939dc1ad3eb059dcbec6 to your computer and use it in GitHub Desktop.
Save ilya-muhortov/b5996085e368939dc1ad3eb059dcbec6 to your computer and use it in GitHub Desktop.
from django.dispatch import receiver
from django.db.models.signals import post_save
from .models import ModelName
__all__ = [
'model_name_post_create'
]
@receiver(post_save, sender=ModelName)
def model_name_post_create(sender, instance, raw, created, **kwargs):
pass
import django.dispatch
__all__ = ['new_signal']
new_signal = django.dispatch.Signal(providing_args=['param', 'another_param'])
def handle_new_signal(param1, another_param):
pass
new_signal.connect(handle_new_signal)
new_signal.send(None, param='param1', another_param='another_param')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment