{% extends 'activities/base.html' %} {% load static %} {% block title %}Audit Log - Ad-tlas{% endblock %} {% block page_title %}Audit Log{% endblock %} {% block page_description %}Detailed audit trail with before/after states and change tracking{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{{ total_audits|default:0 }}

Total Audits

{{ create_audits|default:0 }}

Created

{{ update_audits|default:0 }}

Updated

{{ delete_audits|default:0 }}

Deleted
Audit Logs ({{ page_obj.paginator.count }} total)
{% if audit_logs %}
{% for audit in audit_logs %}
{% if audit.action == 'create' %}
{% elif audit.action == 'update' %}
{% elif audit.action == 'delete' %}
{% endif %}
{{ audit.get_action_display|title }} {{ audit.content_type.model|title }} ID: {{ audit.object_id }}

{{ audit.object_repr|default:'Object representation not available' }}

{{ audit.user.get_full_name|default:audit.user.email|default:'System' }} {{ audit.timestamp|date:'M d, Y H:i' }} {% if audit.changes %} {{ audit.changes|length }} change{{ audit.changes|length|pluralize }} {% endif %}
{% if audit.changes %} {% endif %} {% if audit.before_state or audit.after_state %} {% endif %}
{% if audit.changes %}
Changes: {% for field, change in audit.changes.items|slice:":3" %} {{ field }} {% endfor %} {% if audit.changes|length > 3 %} +{{ audit.changes|length|add:"-3" }} more {% endif %}
{% endif %} {% if audit.action == 'update' and audit.changes %}
{% for field, change in audit.changes.items|slice:":2" %}
{{ field|title }}: {% if change.old %} {{ change.old|truncatechars:50 }} {% endif %} {% if change.new %} {{ change.new|truncatechars:50 }} {% endif %}
{% endfor %} {% if audit.changes|length > 2 %} ... and {{ audit.changes|length|add:"-2" }} more changes {% endif %}
{% endif %}
{% endfor %}
{% if page_obj.has_other_pages %} {% endif %} {% else %}

No Audit Logs Found

No audit logs match your current filters.

Clear Filters
{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}