audit: log event creation on save
This commit is contained in:
parent
7c353f9297
commit
591d2f89a1
|
@ -100,7 +100,6 @@ class Event(UUIDModel):
|
||||||
app = getmodule(stack()[_inspect_offset][0]).__name__
|
app = getmodule(stack()[_inspect_offset][0]).__name__
|
||||||
cleaned_kwargs = sanitize_dict(kwargs)
|
cleaned_kwargs = sanitize_dict(kwargs)
|
||||||
event = Event(action=action.value, app=app, context=cleaned_kwargs)
|
event = Event(action=action.value, app=app, context=cleaned_kwargs)
|
||||||
LOGGER.debug("Created Audit event", action=action, context=cleaned_kwargs)
|
|
||||||
return event
|
return event
|
||||||
|
|
||||||
def from_http(
|
def from_http(
|
||||||
|
@ -129,6 +128,12 @@ class Event(UUIDModel):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"you may not edit an existing %s" % self._meta.model_name
|
"you may not edit an existing %s" % self._meta.model_name
|
||||||
)
|
)
|
||||||
|
LOGGER.debug(
|
||||||
|
"Created Audit event",
|
||||||
|
action=self.action,
|
||||||
|
context=self.context,
|
||||||
|
client_ip=self.client_ip,
|
||||||
|
)
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Reference in New Issue