From 2842cbe1b7d5ff567fffc166389d62371292edc4 Mon Sep 17 00:00:00 2001 From: Joshua Laymon Date: Sun, 31 Aug 2025 13:11:30 +0000 Subject: [PATCH] Update web/templates/tools/audit_log.html --- web/templates/tools/audit_log.html | 120 +++++++++++++++++------------ 1 file changed, 72 insertions(+), 48 deletions(-) diff --git a/web/templates/tools/audit_log.html b/web/templates/tools/audit_log.html index 2665b40..d68e6b5 100644 --- a/web/templates/tools/audit_log.html +++ b/web/templates/tools/audit_log.html @@ -18,62 +18,86 @@ - {% for r in rows %} - - {{ r.timestamp|date:"Y-m-d H:i:s" }} - - {% if r.action == "delete" %} - #{{ r.entry_id }} - {% else %} - #{{ r.entry_id }} - {% endif %} - - - {% if r.action == "create" %} - Created - {% elif r.action == "update" %} - Updated - {% else %} - Deleted - {% endif %} + {% for r in rows %} + + {{ r.timestamp|date:"Y-m-d H:i:s" }} - {% if r.action == "update" and r.changes %} - - {% elif r.action == "create" and r.changes.__created__ %} + + {% if r.action == "delete" %} + #{{ r.entry_id }} + {% else %} + #{{ r.entry_id }} + {% endif %} + + + + {% if r.action == "create" %} + Created + {% elif r.action == "update" %} + Updated + {% else %} + Deleted + {% endif %} + + {% if r.changes %} +
+ {# --- Created: look for the __created__ entry --- #} + {% if r.action == "create" %} + {% for k, v in r.changes.items %} + {% if k == "__created__" %}
Show created fields
    - {% for k, v in r.changes.__created__.items %} -
  • {{ k }}: {{ v }}
  • - {% endfor %} -
-
- {% elif r.action == "delete" and r.changes.__deleted__ %} -
- Deleted record snapshot -
    - {% for k, v in r.changes.__deleted__.items %} -
  • {{ k }}: {{ v }}
  • + {% for f, val in v.items %} +
  • {{ f }}: {{ val }}
  • {% endfor %}
{% endif %} - - {{ r.username|default:"—" }} - - {% empty %} - No audit entries yet. - {% endfor %} - + {% endfor %} + {% endif %} + + {# --- Deleted: look for the __deleted__ entry --- #} + {% if r.action == "delete" %} + {% for k, v in r.changes.items %} + {% if k == "__deleted__" %} +
+ Deleted record snapshot +
    + {% for f, val in v.items %} +
  • {{ f }}: {{ val }}
  • + {% endfor %} +
+
+ {% endif %} + {% endfor %} + {% endif %} + + {# --- Updated: render per-field diffs (other keys) --- #} + {% if r.action == "update" %} + + {% endif %} +
+ {% endif %} + + + {{ r.username|default:"—" }} + + {% empty %} + No audit entries yet. + {% endfor %} +