Go to file
Benjamin Dauvergne c38f63e80b
gitea/django-journal/pipeline/head This commit looks good Details
comaptibility with python 3.11 (#86369)
2024-01-31 12:32:25 +01:00
debian debian: build python3 package (#70074) 2022-10-14 06:57:39 +02:00
django_journal comaptibility with python 3.11 (#86369) 2024-01-31 12:32:25 +01:00
tests comaptibility with python 3.11 (#86369) 2024-01-31 12:32:25 +01:00
.git-blame-ignore-revs misc: update git-blame-ignore-revs to ignore quote changes (#79788) 2023-08-16 11:52:27 +02:00
.gitignore first commit of django-journal 1.0 2012-12-10 14:27:15 +01:00
.pre-commit-config.yaml comaptibility with python 3.11 (#86369) 2024-01-31 12:32:25 +01:00
Jenkinsfile ci: build deb package for bookworm (#78968) 2023-06-23 17:28:11 +02:00
MANIFEST.in packaging: write version in VERSION file (#34881) 2019-07-15 18:10:08 +02:00
README.rst misc: add black/isort/pyupgrade files & notes (#54260) 2021-07-15 16:12:35 +02:00
setup.py misc: apply double-quote-string-fixer (#79788) 2023-08-16 11:52:27 +02:00
test_settings.py misc: apply double-quote-string-fixer (#79788) 2023-08-16 11:52:27 +02:00
test_urls.py setup.py: add command to run tests 2013-09-06 15:02:19 +02:00
tox.ini comaptibility with python 3.11 (#86369) 2024-01-31 12:32:25 +01:00

README.rst

Journal application
===================

Log event to a journal. Keep details of the event linked to the event message,
keep also the template for displaying the event in case we want to improve
display.

To use just do::

      import django_journal
      django_journal.record('my-tag', '{user} did this to {that}',
                 user=request.user, that=model_instance)

Code Style
==========

black is used to format the code, using these parameters::

    black --target-version py37 --skip-string-normalization --line-length 110

There is .pre-commit-config.yaml to use pre-commit to automatically run black
before commits. (execute `pre-commit install` to install the git hook.)

isort is used to format the imports, using these parameter::

    isort --profile black --line-length 110

pyupgrade is used to automatically upgrade syntax, using these parameters::

    pyupgrade --keep-percent-format --py37-plus

There is .pre-commit-config.yaml to use pre-commit to automatically run black,
isort and pyupgrade before commits. (execute `pre-commit install` to install
the git hook.)

Admin display
-------------

``admin.JournalModelAdmin`` recompute messages from the journal message as HTML
adding links for filtering by object and to the ``change`` admin page for the
object if it has one.

Recording error events
----------------------

If you use transactions you must use ``error_record()`` instead of
``record()`` and set ``JOURNAL_DB_FOR_ERROR_ALIAS`` in your settings to
define another db alias to use so that journal record does not happen
inside the current transaction.