Skip to main content

Django-read-log

Simple app to log every time an object is displayed, can be used in combination with django-simple-history for a full audit solution. Currently the standard generic class based views: DetailView, UpdateView, DeleteView, ListView are are supported out of the box, since the views deal with displaying objects as part of the functionality. For DeleteView and UpdateView in most cases you want to display the object (GET request) before you allow the user to delete/update the object.

Other custom views can most likely be supported see Using django-read-log in combination with unsupported views

For each view the following data is stored in the audit model (ReadLog):

user:

Who view the item, can be an anonymous user.

content_object:

A reference to the viewed object using a generic foreign key, if you delete an object the log entry will still be present.

operation:

What operation triggered the the log entry to be written(detail, list, update, delete).

logged_at:

When was the object viewed.

Usage

Easy to use just in 3 simple steps

  1. add the app ‘read_log’ to INSTALLED_APPS in settings.py

  2. run the migration: python manage.py migrate read_log

  3. import and use the mixin

from read_log.view_mixins import ReadLogMixin
from test_read_log.models import TestModel

class TestDetailView(ReadLogMixin, DetailView):
    model = TestModel

Customizing logged operations

By default the following views maps to the following operations.

DetailView:

detail

UpdateView:

update

ListView:

list

Delete:

delete

This can be changed by setting the log_operations attribute to a string of you choice

from read_log.view_mixins import ReadLogMixin
from test_read_log.models import TestModel

class TestDetailView(ReadLogMixin, DetailView):
    log_operation = 'my_choice'
    model = TestModel

Using django-read-log in combination with unsupported views

Because the view mixin hooks into the get_context_data view function it should be possible to add the mixin to unsupported views as long as they either implement or inherit the get_context_data function (eg. from SingleObjectMixin or MultipleObjectMixin) and define the class attribute ‘log_operation’ to the string you want to have logged as the operations field.

Presentation not included

When audit is needed you normally want to limit the expose of data hench forth no presentation of the ReadLog is included and if you need a way to display the Readlog it is up to you to implement it.

from django.contrib import admin
from read_log.models import ReadLog

admin.site.register(ReadLog)

Metadata

Release files for django-read-log 0.80

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-read-log 0.80
File Size Uploaded Provenance Actions
django-read-log-0.80.tar.gz 4.4 kB Without provenance Details for django-read-log-0.80.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-read-log 0.80
File Interpreter ABI Platform Actions
django_read_log-0.80-py3-none-any.whl Python 3 none any Details for django_read_log-0.80-py3-none-any.whl

Total release size: 10.6 kB

Release files / django-read-log-0.80.tar.gz

Download URL django-read-log-0.80.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5a252c38b44173f73a23b5a95fba312ac353deb5569c3b997cb3011634d62b6d
BLAKE2b-256 checksum
How to use checksums
e161fbb21d4fafd232209d4f4644824fe746a64859686c1c1fb0e992fb4235de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

Release files / django_read_log-0.80-py3-none-any.whl

Download URL django_read_log-0.80-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4989bc7d478ce8e0bc5bba97892766d1bf23cc7269583da99b7e7e7140ddb9c
BLAKE2b-256 checksum
How to use checksums
5df61cb58685c7faac31559a2654a7992b83fcd129fe247ec2dacdfa29980e22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

Security for django-read-log 0.80

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.

Release history Release notifications | RSS feed

This release

0.80 This release

2 release files No provenance

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