Skip to content

A reusable Django app to log actions and display them in a timeline 📝

License

Notifications You must be signed in to change notification settings

maykinmedia/django-timeline-logger

Repository files navigation

django-timeline-logger

A reusable Django app to log actions and display them in a timeline

Build status Code quality checks Ruff Coverage status Documentation Status

python-versions django-versions pypi-version

Prerequisites

This project uses django.db.models.JSONField, and as such, you need:

  • Django 4.2+
  • a database supporting django.db.models.JSONField

Installation

Install from PyPI by running

pip install django-timeline-logger

Add 'timeline_logger' to your INSTALLED_APPS.

Run the migrations:

python manage.py migrate

Usage in templates

A custom template tag is provided to render the message of a log entry, for example:

{% extends "timeline_logger/base.html" %}
{% load timeline %}

{% block timeline %}
    <ul class="timeline__list col__22--vw">
    {% for log in object_list %}
        <li class="timeline__entry">
            {% render_message log in_view=True %}
        </li>
    {% endfor %}
    </ul>
{% endblock timeline %}

This way, you can pass extra context to the template used for the log object.

Documentation

The extended documentation is available on Read the Docs.

Local development

To install and develop the library locally, use:

pip install -e .[tests,docs,release]

When running management commands via django-admin, make sure to add the root directory to the python path (or use python -m django <command>):

export PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests.settings_pg
django-admin check
# or other commands like:
# django-admin makemessages -l nl

About

A reusable Django app to log actions and display them in a timeline 📝

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 7