Log
* adds modal_generic.html template for generic usage * adds M2M field log to BaseObject * adds show log button to controls.html * adds logging on adding related objects * adds render log table using generic modal * adds tooltip to missing values in detail views * adds/updates translations
This commit is contained in:
@@ -48,6 +48,7 @@ class UserAction(models.TextChoices):
|
||||
CHECKED = "checked", _("Checked")
|
||||
RECORDED = "recorded", _("Recorded")
|
||||
CREATED = "created", _("Created")
|
||||
EDITED = "edited", _("Edited")
|
||||
DELETED = "deleted", _("Deleted")
|
||||
|
||||
|
||||
@@ -70,6 +71,22 @@ class UserActionLogEntry(models.Model):
|
||||
help_text="Short name for performed action - optional",
|
||||
choices=UserAction.choices,
|
||||
)
|
||||
comment = models.CharField(max_length=255, null=True, blank=True, help_text="Additional comment on this entry")
|
||||
|
||||
def __str__(self):
|
||||
return "{} | {} | {}".format(self.user.username, self.timestamp, self.action)
|
||||
return "{} | {} | {}".format(self.user.username, self.timestamp, self.action)
|
||||
|
||||
@property
|
||||
def action_humanize(self):
|
||||
""" Returns humanized version of enum
|
||||
|
||||
Used for template rendering
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
choices = UserAction.choices
|
||||
for choice in choices:
|
||||
if choice[0] == self.action:
|
||||
return choice[1]
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user