This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/audit/models.py

23 lines
647 B
Python
Raw Normal View History

2018-11-23 16:05:41 +00:00
"""passbook audit models"""
from django.conf import settings
from django.db import models
from reversion import register
from passbook.lib.models import UUIDModel
@register()
class AuditEntry(UUIDModel):
"""An individual audit log entry"""
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)
action = models.TextField()
date = models.DateTimeField(auto_now_add=True)
app = models.TextField()
def save(self, *args, **kwargs):
if self.pk:
raise NotImplementedError("you may not edit an existing %s" % self._meta.model_name)
super().save(*args, **kwargs)