Skip to main content

Keep track of all your model changes with ease.

Project description

Masonite Audit

GitHub Workflow Status PyPI issues Python Version GitHub release (latest by date including pre-releases) License star downloads Code style: black

Introduction

Keep track of all your model changes with ease.

Getting Started

Install the package using pip:

pip install masonite-audit

Add AuditProvider to your project in config/providers.py:

# config/providers.py
# ...
from masonite_audit import AuditProvider

# ...
PROVIDERS = [
    # ...
    # Third Party Providers
    AuditProvider,
    # ...
]

Publish the package configuration files.

python craft package:publish masonite-audit

This will add migrations and other masonite-audit related configuration to your project. Run your migrations to create the related database tables.

python craft migrate

Finally, inherit Audit mixin into all the models for which you need audit logging.

from masonite_audit.mixins import Audit
class YourModel(Audit):
    pass

If you want to get the audit history for a model, you can use the history method:

user = User.find(1)
user.history()

In order to rollback to previous versions of a model, you can use the rollback method:

user = User.find(1)
user.rollback() # to rollback to previous version
# or
user.rollback(step=4) # to rollback to version 4

License

Masonite Audit is open-sourced software licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

masonite-audit-0.0.6.tar.gz (75.7 kB view details)

Uploaded Source

Built Distribution

masonite_audit-0.0.6-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file masonite-audit-0.0.6.tar.gz.

File metadata

  • Download URL: masonite-audit-0.0.6.tar.gz
  • Upload date:
  • Size: 75.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for masonite-audit-0.0.6.tar.gz
Algorithm Hash digest
SHA256 dfb5b2684f333ee39b4add0013c2cc9b96d6bdd77b38fe6c12b0f0de24add97f
MD5 8ebb12a40aaef39a6eb67c90acf01083
BLAKE2b-256 84f5c51de17bc1582f888101b991ecfd234c62c4f767492b13aef4e8a1c23f4f

See more details on using hashes here.

File details

Details for the file masonite_audit-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for masonite_audit-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 84daa3e2ec16474d83914946c0083dcfaf8b9281568bc5268f517c2b89be309a
MD5 764c93ea5c414d38fd2b3819fa718bbc
BLAKE2b-256 bfc2518da440ecd53908e8a0ea60ce695e293ae9f9d9d21e9e94c22e03679af6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page