{% macro _m_audit_field_changes(changes) %} {% endmacro %} {% macro m_audit_log(entries) %} {%- if entries %}
{%- for entry in entries %} {%- if entry.related or entry.op == 1 %}
{{ entry.user.name }} made changes on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }} {{ _m_audit_field_changes(entry.changes) }}
{%- elif entry.type == 0 %}
{{ entry.user.name }} created this record on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }}
{%- endif %} {%- endfor %}
{%- endif %} {% endmacro %}