def flag_instance_handler(sender, instance, created=False, **kwargs): if not created: return flagged.send(instance.flag.content_object, flag=instance.flag, created=False)
def flag_handler(sender, instance, created=False, **kwargs): if created: flagged.send(instance.content_object, flag=instance, created=created) return # The status didn't change. Return. if instance._pre_save_status == instance.status: return if instance.status == FLAGGED: flagged.send(instance.content_object, flag=instance, created=False) elif instance.status == REVIEW: review.send(instance.content_object, flag=instance) elif instance.status == CONTENT_REJECTED: rejected.send(instance.content_object, flag=instance) elif instance.status == CONTENT_APPROVED: approved.send(instance.content_object, flag=instance)