Skip to main content

A Django application that allows you to store detailed data in the change log and display the detailed information in object's history view.

Project description

django-data-history

A Django application that allows you to store detailed data in the change log and display the detailed information in object's history view.

Install

pip install django-data-history

Usage


## add app: django_middleware_global_request
## add app: django_static_jquery_ui
## add app: django_data_history
## put django_data_history before django.contrib.admin

INSTALLED_APPS = [
    ...
    "django_middleware_global_request",
    "django_static_jquery_ui",
    'django_data_history',
    ...
    'django.contrib.admin',
    ...
]

## add middleware: django_middleware_global_request.middleware.GlobalRequestMiddleware
## add middleware: django_data_history.middlewares.HttpXRequestIdMiddleware
MIDDLEWARE = [
    ...
    "django_middleware_global_request.middleware.GlobalRequestMiddleware",
    "django_data_history.middlewares.HttpXRequestIdMiddleware",
    ...
]

## add X-Request-Id in nginx config file
## set_proxy_header X-Request-Id $reqid
## Change REQUEST_ID_HEADER to match the request header
REQUEST_ID_HEADER = "HTTP_X_REQUEST_ID"

## auto generate request id if the header is not set by nginx
AUTO_GENERATE_REQUEST_ID = True

# default to False, so you must set it to True to enable all models injection.
SAVE_DATA_HISTORIES_FOR_ALL = True 

# if SAVE_DATA_HISTORIES_FOR_ALL==False, then only these models will be injected.
# default to empty.
SAVE_DATA_HISTORIES_FOR = [
    "your_app1.model_name1"
]

# if SAVE_DATA_HISTORIES_FOR_ALL==True, these models will NOT be injected.
# default to:
# [
#    "sessions.session",
#    "contenttypes.contenttype",
#    "admin.logentry",
#    "auth.permission",
# ]
DO_NOT_SAVE_DATA_HISTORIES_FOR = [
    "your_app2.model_name2",
]

Instance's history view

django-date-history-view-preview

Releases

v0.1.0

  • First release.

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

django-data-history-0.1.0.tar.gz (12.5 kB view hashes)

Uploaded Source

Built Distribution

django_data_history-0.1.0-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

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