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"])
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_federation_auditlog-1.1.0.tar.gz | 12.2 kB | Without provenance | Details for django_federation_auditlog-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_federation_auditlog-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for django_federation_auditlog-1.1.0-py3-none-any.whl |
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
|
Security for django-federation-auditlog 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.