* 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:
mipel
2021-08-05 12:54:28 +02:00
parent 718d5acde5
commit 71bbb3921a
18 changed files with 368 additions and 146 deletions

View File

@@ -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