Skip to content

Django management command and middleware for creating and maintaining PostgreSQL audit trail triggers.

License

Notifications You must be signed in to change notification settings

ruttenb/django-history-triggers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

  • Django 1.8+
  • PostgreSQL database

Using Django History Triggers

  1. Add "history" to your INSTALLED_APPS setting.
  2. Add "history.middleware.HistoryMiddleware" to the end of your MIDDLEWARE_CLASSES setting. (Or before, if another middleware needs the history table)
  3. Run "manage.py triggers" to create the history schema, history tables, and associated triggers.

Settings

  • HISTORY_SCHEMA (default: "history")
  • HISTORY_USER_TEMP_TABLE (default: "history_user")
  • HISTORY_USER_FIELD (default: "user_id")
  • HISTORY_USER_TYPE (default: "integer")
  • HISTORY_REQUEST_USER_FIELD (default: "user")
  • HISTORY_REQUEST_USER_ATTRIBUTE (default: "pk")
  • HISTORY_DB_ROLE (default: settings.DATABASES['default']['USER'])
  • HISTORY_IGNORED_TABLES (default: [])
  • HISTORY_IGNORED_PREFIXES (default: ["django_", "auth_", "south_"])
  • HISTORY_IGNORED_TYPES (default: ["bytea"])
  • HISTORY_IGNORED_COLUMNS (default: [])
  • HISTORY_USE_TIMEZONES (default: True)
  • HISTORY_DEFAULT_USER (default: 0)
  • HISTORY_DEFAULT_USER_ERROR (default: False)
  • HISTORY_MIDDLEWARE_IGNORE (default: [settings.STATIC_URL, settings.MEDIA_URL])
  • HISTORY_JSON (default: False)

Running Unit Tests

docker-compose up --exit-code-from tests

About

Django management command and middleware for creating and maintaining PostgreSQL audit trail triggers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%