示例#1
0
def class_prepared_signal_handler(sender, **kwargs):
    if sender.__name__ == "ActionItem":
        register = receiver(
            models.signals.post_save,
            sender=sender,
            dispatch_uid="publicweb.models.actionitem_signal_handler")
        register(actionitem_signal_handler)
示例#2
0
 def wrapper(sender, instance, raw, using, **kwargs):
     if raw:
         instance = sender._default_manager.using(using).get(pk=instance.pk)
     return receiver(sender=sender,
                     raw=raw,
                     instance=instance,
                     using=using,
                     **kwargs)
示例#3
0
 def wrapper(sender, instance, raw, using, **kwargs):
     if raw:
         instance = sender._default_manager.using(using).get(pk=instance.pk)
     return receiver(sender=sender, raw=raw, instance=instance, using=using,
                     **kwargs)
示例#4
0
class SignalTest(TestCase):

    def test_post_save(self):
        created = []

        @receiver(post_save, sender=SetModel)
示例#5
0
from django.db.models.signals import pre_delete
from django.dispatch.dispatcher import receiver

from v1.models import Artikel, Slider, Potensi, Lapor


def delete_image(sender, instance, **kwargs):
    instance.gambar.delete(save=False)


receiver(pre_delete, sender=Artikel)(delete_image)
receiver(pre_delete, sender=Slider)(delete_image)
receiver(pre_delete, sender=Potensi)(delete_image)
receiver(pre_delete, sender=Lapor)(delete_image)
示例#6
0
def class_prepared_signal_handler(sender, **kwargs):
    if sender.__name__ == "ActionItem":
        register = receiver(models.signals.post_save,
                            sender=sender,
                            dispatch_uid="publicweb.models.actionitem_signal_handler")
        register(actionitem_signal_handler)