Go to file
Emmanuel Cazenave 78f567c6fe
gitea/django-journal/pipeline/head Build started... Details
build: test against django 3.2 (#66101)
2022-06-09 15:41:54 +02:00
debian debian: stop building the python2 package (#53470) 2021-04-27 15:59:12 +02:00
django_journal django 3.2: stop using @python_2_unicode_compatible (#66101) 2022-06-09 15:38:54 +02:00
tests misc: apply black/isort/pyupgrade (#54260) 2021-07-15 16:11:51 +02:00
.git-blame-ignore-revs misc: add black/isort/pyupgrade files & notes (#54260) 2021-07-15 16:12:35 +02:00
.gitignore first commit of django-journal 1.0 2012-12-10 14:27:15 +01:00
.pre-commit-config.yaml misc: add black/isort/pyupgrade files & notes (#54260) 2021-07-15 16:12:35 +02:00
Jenkinsfile jenkins: build packages for buster & bullseye 2021-12-20 06:29:21 +01: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 build: test against django 3.2 (#66101) 2022-06-09 15:41:54 +02:00
test_settings.py misc: apply black/isort/pyupgrade (#54260) 2021-07-15 16:11:51 +02:00
test_urls.py setup.py: add command to run tests 2013-09-06 15:02:19 +02:00
tox.ini build: test against django 3.2 (#66101) 2022-06-09 15:41:54 +02: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.