Skip to main content

A Django app that keeps a log of user actions or changes in objects

Project description

https://img.shields.io/pypi/dm/django-actions-logger.svg https://img.shields.io/pypi/v/django-actions-logger.svg

A Django app that keeps a log of user actions or changes in objects You can log arbitrary action with user and optional info that goes with your action.

this code forked from django-auditlog and add my new ideas

Quick start

  1. Add “actionslog” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'actionslog',
    ]
    
  2. Run python manage.py migrate to create models.

  3. Set AL_LOG_ACTION_CHOICES in project settings.py file if need customize:

    AL_LOG_ACTION_CHOICES = [
        (CREATE, _("create")),
        (SUCCESS, _("success")),
        (VIEW, _("view")),
        (UPDATE, _("update")),
        (DELETE, _("delete")),
        (ERROR, _("error")),
    ]
    

Usage

Simple:

status_msg = 'Reset password %s' % ('success' if success else 'error',)
la_kwargs = {
    'request': request,
    'instance': obj,
    'user': request.user,
    'action_info': {'info': status_msg},
}
LogAction.objects.create_log_action(**la_kwargs)

or

status_msg = 'Reset password %s' % ('success' if success else 'error',)
la_kwargs = {
    'request': request,
    'instance': obj,
    'user': request.user,
    'action': LogAction.SUCCESS if success else LogAction.ERROR,
    'changes': status_msg,
}
LogAction.objects.create_log_action(**la_kwargs)

Project details


Download files

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

Files for django-actions-logger, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size django-actions-logger-0.3.1.tar.gz (10.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page