Beispiel #1
0
def raw_custom_event(
        sender,
        event_name,
        payload,
        user,
        send_hook_meta=True,
        instance=None,
        trust_event_name=False,
        **kwargs
):
    """
    Give a full payload
    """
    model_label = get_model_label(instance)

    new_payload = payload

    if send_hook_meta:
        new_payload = lambda hook, instance: {
            'hook': hook.dict(),
            'data': payload
        }

    distill_model_event(
        instance,
        model_label,
        None,
        user_override=user,
        event_name=event_name,
        trust_event_name=trust_event_name,
        payload_override=new_payload,
    )
Beispiel #2
0
def raw_custom_event(
        sender,
        event_name,
        payload,
        user,
        send_hook_meta=True,
        instance=None,
        trust_event_name=False,
        **kwargs
        ):
    """
    Give a full payload
    """
    model_label = get_model_label(instance)

    new_payload = payload

    if send_hook_meta:
        new_payload = lambda hook, instance: {
            'hook': hook.dict(),
            'data': payload
        }

    distill_model_event(
        instance,
        model_label,
        None,
        user_override=user,
        event_name=event_name,
        trust_event_name=trust_event_name,
        payload_override=new_payload,
    )
def custom_action(sender, action, instance, user=None, **kwargs):
    """
    Manually trigger a custom action (or even a standard action).
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, action, user_override=user)
def model_deleted(sender, instance, using, **kwargs):
    """
    Automatically triggers "deleted" actions.
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, 'deleted')
Beispiel #5
0
def model_deleted(sender, instance,
                  using,
                  **kwargs):
    """
    Automatically triggers "deleted" actions.
    """
    model_label = get_model_label(instance)
    distill_model_event(instance, model_label, 'deleted')
Beispiel #6
0
def model_deleted(sender, instance,
                          using,
                          **kwargs):
    """
    Automatically triggers "deleted" actions.
    """
    model_label = get_model_label(instance)
    distill_model_event(instance, model_label, 'deleted')
def model_saved(sender, instance, created, raw, using, **kwargs):
    """
    Automatically triggers "created" and "updated" actions.
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    action = 'created' if created else 'updated'
    distill_model_event(instance, model, action)
Beispiel #8
0
def custom_action(sender, action,
                  instance,
                  user=None,
                  **kwargs):
    """
    Manually trigger a custom action (or even a standard action).
    """
    model_label = get_model_label(instance)
    distill_model_event(instance, model_label, action, user_override=user)
Beispiel #9
0
def custom_action(sender, action,
                          instance,
                          user=None,
                          **kwargs):
    """
    Manually trigger a custom action (or even a standard action).
    """
    model_label = get_model_label(instance)
    distill_model_event(instance, model_label, action, user_override=user)
def model_deleted(sender, instance,
                          using,
                          **kwargs):
    """
    Automatically triggers "deleted" actions.
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, 'deleted')
def custom_action(sender, action,
                          instance,
                          user=None,
                          **kwargs):
    """
    Manually trigger a custom action (or even a standard action).
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, action, user_override=user)
Beispiel #12
0
def model_saved(sender, instance,
                created,
                raw,
                using,
                **kwargs):
    """
    Automatically triggers "created" and "updated" actions.
    """
    model_label = get_model_label(instance)
    action = 'created' if created else 'updated'
    distill_model_event(instance, model_label, action)
Beispiel #13
0
def model_saved(sender, instance,
                        created,
                        raw,
                        using,
                        **kwargs):
    """
    Automatically triggers "created" and "updated" actions.
    """
    model_label = get_model_label(instance)
    action = 'created' if created else 'updated'
    distill_model_event(instance, model_label, action)
def model_saved(sender, instance,
                        created,
                        raw,
                        using,
                        **kwargs):
    """
    Automatically triggers "created" and "updated" actions.
    """
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    action = 'created' if created else 'updated'
    distill_model_event(instance, model, action)