* Add test cases for the `mask_str` function
* Add custom masking function support through mask_callable
* Add test cases for custom masking function
* Update documentation for custom masking function
* fix test case
* rename `AUDITLOG_DEFAULT_MASK_CALLABLE` variable
-AUDITLOG_DEFAULT_MASK_CALLABLE to `AUDITLOG_MASK_CALLABLE`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update `CHANGELOG.md` to include mask function customization feature
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* 'get_field_value' - improve default value handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add Test cases
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Branch that implements issue #675, basically, storing the correct JSON type that corresponds to the Python type (None -> null, 1 -> 1', not "1"`).
It's driven by a setting, AUDITLOG_ STORE_JSON_CHANGES , as recommended by @hramezani
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* code formatting tweaks from @hramezani
* increasing test coverage
* added usage for AUDITLOG_STORE_JSON_CHANGES setting
* updated CHANGELOG with info on AUDITLOG_STORE_JSON_CHANGES field
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added another test for wrong setting type
* should not have committed temporary test changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Refactor: re-arrange test application
This was triggered by the need to run "python manage.py", which is impossible when serving the whole project in the same directory as is configured in INSTALLED_APPS ("auditlog_tests"). This setup is heavily inspired by other jazzband projects.
* Add check for missing migrations
* Fix IntegrityError when cloning objects with pk=None
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add ability to globally mask fields by name on all models.
Fixes https://github.com/jazzband/django-auditlog/issues/701
* Add feature explanation in `usage.rst` file.
* Add a record to CHANGELOG.md file.
* Add test coverage.
* Update admin.py
allow filtering by timestamp with date_hierarchy in admin
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: DavidHaas1 <david.haas@takeda.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix: use sender for m2m signal dispatch connection
This fix adds support for a use case where a single m2m through model is
used on multiple models. When the reciever is used for the dispatch uid
in this use case it cause duplicated logs because the through model
singal connection happens multiple times.
By changing the m2m signal connection to use the sender for the dispatch
uid this duplication is prevented because the signal connection only
happens once for the through model.
Refs: #685
* fix(format): apply black formatting
* add test and changelog entry
* remove unused import
* correct import sorting
* move change log message to correct section
* Add AUDITLOG_TRUNCATE_CHANGES_DISPLAY and AUDITLOG_TRUNCATE_LIMIT
To configure how many characters will be truncated or disable it
* Add AUDITLOG_CHANGE_DISPLAY_TRUNCATE_LENGTH settings
to keep or truncate strings of `changes_display_dict` property at a variable length
* [feat]: Add truncate option to flush command
* [test]: Add test cases for flush command with truncate
* [refactor]: Simplified truncate query class and remove redundant return statement
* [test]: Add test cases to test truncate for unsupported database vendor
* [docs]: Update change log
* run postgres query for rows that changes is null for them and there is value for changes_text
* add a test case to make when changes has value it wont be overwritten by changes_text
* Use `attname` to get pk value
* Add tests for model as primary key
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add clarifying comments to _get_pk_value
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix serialize __proxy__ objects before logging
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update CHANGELOG.md
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* Disable logging remote IP address
* Update auditlog/middleware.py
* Update CHANGELOG.md
* Update auditlog/middleware.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update auditlog/middleware.py and add tests in ManyRelatedModelTest
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>