Skip to main content

Django Auditlog

This project is totally based in Django Auditlog library.

Instalation

with pip

pip install django-federation-auditlog

with pipenv

pipenv install django-federation-auditlog

with poetry

poetry add django-federation-auditlog

Adding Django Federation Auditlog to your Django application

To use in your application, just add 'django-federation-auditlog' to your project’s INSTALLED_APPS setting and add 'AuditlogMiddleware' to your's MIDDLEWARE setting then run manage.py migrate to create/upgrade the necessary database structure.

INSTALLED_APPS = [
    # other apps
    "django_federation_auditlog",
]

and

MIDDLEWARE = [
    # others middlewares
    "django_federation_auditlog.middleware.AuditlogMiddleware",
]

Then run

python manage.py migrate

Usage

Auditlog can automatically log changes to objects for you. This functionality is based on Django’s signals, but linking your models to Django Federation Auditlog is even easier using signals.

from django.db import models

from django_federation_auditlog.registry import auditlog

class MyModel(models.Model):
    pass
    # Model definition goes here

auditlog.register(MyModel)

It is recommended to place the register code (auditlog.register(MyModel)) at the bottom of your models.py file.

OBS: If .save() be called to a model and the fields have the same value, log entries don't be generated.

Including Fields

If include_fields is specified, only the fields with the given names will be included in the generated log entries.

For example, to include only the field name from class MyModel, use:

from django.db import models

from django_federation_auditlog.registry import auditlog

class MyModel(models.Model):
    name = models.CharField()
    description = models.CharField()
    # Model definition goes here

auditlog.register(MyModel, include_fields=["name"])

Excluding fields

Fields that are excluded will not trigger saving a new log entry and will not show up in the recorded changes.

If exclude_fields is specified the fields with the given names will not be included in the generated log entries.

For example, to exclude the field description, use:

from django.db import models

from django_federation_auditlog.registry import auditlog

class MyModel(models.Model):
    name = models.CharField()
    description = models.CharField()
    # Model definition goes here

auditlog.register(MyModel, exclude_fields=["description"])

Release files for django-federation-auditlog 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-federation-auditlog 1.1.0
File Size Uploaded
django_federation_auditlog-1.1.0.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-federation-auditlog 1.1.0
File Interpreter ABI Platform
django_federation_auditlog-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / django_federation_auditlog-1.1.0.tar.gz

Download URL django_federation_auditlog-1.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b0310f7625fa46b487812facf77ee350b4fb7c513adb4fe8d27eec4f64a567a
BLAKE2b-256 checksum
How to use checksums
fcbdea3c44866e138a3b55c09121a5b0c85e9578f67370deeb70e50809677774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure

Release files / django_federation_auditlog-1.1.0-py3-none-any.whl

Download URL django_federation_auditlog-1.1.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fb04e057f673107e604f60f5bcfadb3ea5e0cf9892e5bf3efbdb31208c52b6e
BLAKE2b-256 checksum
How to use checksums
7833c7aba409de1f00391bc9dfc6956b7179cf50d97606de5c32310e2210a3c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page