def snailtracker_post_save_hook(sender, instance, **kwargs):
    """
    If connected to the Django model's post_save signal, this will fire
    and make a snapshot of the instance's current state (field values) then
    save a snailtrack (if it doesn't exist) and an action.
    """
    try:
        instance.post_save_snapshot = make_model_snapshot(instance)
        # prevent circular imports
        from django_snailtracker.tasks import offload_wrapper, celery_enabled
        if celery_enabled:
            offload_wrapper.delay(instance)
            logger.debug('%s model instanced saved. '
                    'Offloaded snailtracker task to Celery.' % instance)
        else:
            get_or_create_snailtrack(instance)
        instance.snailtracker_new = False
    except Exception, e:
        try:
            import traceback
#:TODO: this...
            send_mail(
                    'Snailtracker Error!',
                    traceback.format_exc(),
                    '*****@*****.**', ('*****@*****.**'))
            return
        except:
            return
def snailtracker_post_init_hook(sender, instance, **kwargs):
    """
    If connected to the Django model's post_init signal, this will
    fire and make a snapshot of the instance's current state (field values).
    """
    try:
        instance.snailtracker_new = False
        if not instance.id:
            instance.snailtracker_new = True
        instance.post_init_snapshot = make_model_snapshot(instance)
    except Exception, e:
        try:
            import traceback
#:TODO: this...
            send_mail(
                    'Snailtracker Error!',
                    traceback.format_exc(),
                    '*****@*****.**',
                    ('*****@*****.**'))
            return
        except:
            return