https://docs.djangoproject.com/es/1.10/ref/signals/#post-save

def pre_save(sender, instance, raw, using, update_fields, **kwargs):
    """https://docs.djangoproject.com/es/1.10/ref/signals/#post-save"""
    if raw:
        # Return if loading Fixtures
        return

    try:
        with transaction.atomic():
            if not should_audit(instance):
                return False
            try:
                object_json_repr = serializers.serialize("json", [instance])
            except Exception:
                # We need a better way for this to work. ManyToMany will fail on pre_save on create
                return None

            if instance.pk is None:
                created = True
            else:
                created = False

            # created or updated?
            if not created:
                old_model = sender.objects.get(pk=instance.pk)
                delta = model_delta(old_model, instance)
                changed_fields = json.dumps(delta)
                event_type = CRUDEvent.UPDATE

            # user
            try:
                user = get_current_user()
                # validate that the user still exists
                user = get_user_model().objects.get(pk=user.pk)
            except:
                user = None

            if isinstance(user, AnonymousUser):
                user = None

            # callbacks
            kwargs['request'] = get_current_request()  # make request available for callbacks
            create_crud_event = all(
                callback(instance, object_json_repr, created, raw, using, update_fields, **kwargs)
                for callback in CRUD_DIFFERENCE_CALLBACKS if callable(callback))
            # create crud event only if all callbacks returned True
            if create_crud_event and not created:
                c_t = ContentType.objects.get_for_model(instance)
                sid = transaction.savepoint()
                try:
                    with transaction.atomic():
                        crud_event = CRUDEvent.objects.create(
                            event_type=event_type,
                            object_repr=str(instance),
                            object_json_repr=object_json_repr,
                            changed_fields=changed_fields,
                            content_type_id=c_t.id,
                            object_id=instance.pk,
                            user_id=getattr(user, 'id', None),
                            datetime=timezone.now(),
                            user_pk_as_string=str(user.pk) if user else user
                        )
                except Exception as e:
                    logger.exception(
                        "easy audit had a pre-save exception on CRUDEvent creation. instance: {}, instance pk: {}".format(
                            instance, instance.pk))
                    transaction.savepoint_rollback(sid)
    except Exception:
        logger.exception('easy audit had a pre-save exception.')