Skip to content

Audit log and tracking changes

Mathieu Rampant edited this page Dec 16, 2022 · 6 revisions

If you want to track who and what changes are made to NEMO's data, we recommend setting up and using the excellent plugin Django Auditlog

It can be set in 3 steps:

  1. Add 'auditlog' in your settings' INSTALLED_APPS
  2. Add 'NEMO.middleware.NEMOAuditlogMiddleware' to your settings' MIDDLEWARE
  3. Define what you want to track in your settings.py:
AUDITLOG_INCLUDE_TRACKING_MODELS = [
    # Track access expiration for users as well as role changes
    {
        "model": "NEMO.User",
        "include_fields": ["access_expiration", "is_staff", "is_user_office", "is_accounting_officer", "is_service_personnel", "is_technician", "is_facility_manager", "is_superuser"],
    },
    # Track all changes on PhysicalAccessLevel
    "NEMO.PhysicalAccessLevel",
]

NEMO Model names and fields can be found in models.py

The log entries will be available in Detailed administration -> AUDIT LOG -> Log entries

For Users, the user history will include the user's tracked data