Skip to main content

django-audimatic

Coverage Status

Easy audit trails.

Installation

pip install django-audimatic

# or

pipenv install django-audimatic

# or

# install with your manager of choice

Usage

  1. Add to INSTALLED_APPS

    INSTALLED_APPS = [
        ...,
        "django_audimatic",
        ...
    ]
    
  2. Create audit trail tables and subclass AuditTrigger

    from django.contrib.auth.models import AbstractUser
    from django_audimatic.models import AuditTrail, AuditTrigger
    
    
    class UserAuditTrail(AuditTrail):
        pass
    
    
    class CustomUser(AbstractUser, AuditTrigger):
        class Meta(AuditTrigger.Meta):
            audit_table = UserAuditTrail
    
  3. Register AdminModels

    from django.contrib import admin
    from django.contrib.auth.admin import UserAdmin
    
    from django_audimatic.admin import DiffInline
    from testapp.models import CustomUser, UserAuditTrail
    
    
    class CustomUserAuditTrail(DiffInline):
        model = CustomUser.get_audit_table()
    
    
    class CustomUserAdmin(UserAdmin):
        inlines = (CustomUserAuditTrail,)
    
    
    admin.site.register(UserAuditTrail, admin.ModelAdmin)
    admin.site.register(CustomUser, CustomUserAdmin)
    
  4. Add HStoreExtension

    from django.contrib.postgres.operations import HStoreExtension
    
    ...
        operations = [
            HStoreExtension(),
        ]
    ...
    

Other

This project uses django-pgtrigger and django-nonrelated-inlines.

Currently, (as of Django 4.2.4) there is logic that registers these automatically, this might break in future version of Django.

There is functionality to disable migration support in pgtrigger, however that is not recommended or tested.

Inlines will always be registered as well, this is for simplicity, but maybe we add some options in the future.

License

Copyright 2023 Bill Schumacher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for django-audimatic 0.4.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-audimatic 0.4.0
File Size Uploaded Provenance Actions
django_audimatic-0.4.0.tar.gz 5.4 kB Without provenance Details for django_audimatic-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-audimatic 0.4.0
File Interpreter ABI Platform Actions
django_audimatic-0.4.0-py3-none-any.whl Python 3 none any Details for django_audimatic-0.4.0-py3-none-any.whl

Total release size: 14.2 kB

Release files / django_audimatic-0.4.0.tar.gz

Download URL django_audimatic-0.4.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
350d298e47716493faf13f353955c72f5719bda55a450c6cf6f51f05a35de6d3
BLAKE2b-256 checksum
How to use checksums
38a53ef58de0a9f92ee3f4d77690616b31004bc1134a51969ca881c7fe422a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / django_audimatic-0.4.0-py3-none-any.whl

Download URL django_audimatic-0.4.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
201671dd63afe0bdc8276859e11b50a843e5c77a04c049fa5027e86890bac49a
BLAKE2b-256 checksum
How to use checksums
083763b3619dff6776ffab29782ad806a04e4b7da032c80da2ebc420b44ea817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Security for django-audimatic 0.4.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.

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