* Add test case to test log entry changes_str property for m2m changes.
* Add support for m2m field changes and generic changes in AbstractLogEntry.changes_str property.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add more test cases for changes_str.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add chengelog note
* Validate type and length of changes_dict values.
* Restructure change iterator.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Use getattr() with default value in get_logentry_model() to handle
cases where conf.py hasn't been imported yet due to import order.
Adds regression test to verify the fix.
* add new setting to activate string repr
* skip using foreign key to construct and display diff of foreign key fields
* concise name and documentation update
# Conflicts:
# docs/source/usage.rst
* add test for enabled setting
* fix code block in docs
* fix version
* add warning to documentation
* Add failing test for diffing polymorphic model instances.
* Make diffing more robust for polymorphic models:
When working with polymorphic models, where a child model inherits from a
parent model, Django's pre_save signal may send model instances in a way
where the log_update() handler receives an instance of the child as the
`old` model, but an instance of the parent as the `new` model.
This leads to a `FieldDoesNotExist` error when a field that only exists on the
child was modified, and `get_field_value()` attempts look up that field on the
parent.
This change makes diffing polymorphic models more robust by considering this
case in `get_default_value()`. Changes to those child fields won't be tracked
in these cases, but at least `django-auditlog` won't prevent the model from
being saved.
* Add CustomLogEntry model support and update tests:
- Added support for CustomLogEntry data model to extend django-auditlog capabilities
- Updated existing test cases to align with new model structure and data handling logic
- Added new test cases to validate CustomLogEntry behavior, model registration, and signal handling
- Ensured backward compatibility with existing LogEntry model where applicable
* Update auditlog/__init__.py
Co-authored-by: Youngkwang Yang <me@youngkwang.dev>
* run only one custom model test matrix (#761)
---------
Co-authored-by: Youngkwang Yang <me@youngkwang.dev>
* Add `AUDITLOG_USE_BASE_MANAGER` setting configuration
* Adjust `LogEntry._get_changes_display_for_fk_field` behaviour for setting
* Adjust `log_update` and `log_m2m_changes` in `receivers.py` for setting
* Add `ModelManagerTest.test_use_base_manager_setting`
* Add entry in Usage documentation
* (In passing, fix a formatting issue in `usage.rst`)
The `AUDITLOG_USE_BASE_MANAGER` setting has a default of `False` to maintain
initial backwards compatibility with previous versions.
* Drop Python 3.9 support, set minimum version to 3.10
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update CHANGELOG.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix lint error
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Amend setup configuration to include non-python package files
Fixes: #767
Adds locale files created in: #762
* Amend render tests to use templatetag
Tests now use the public interface to render function.
Addresses regression in test coverage caused by adding templatetag to wheel.
* Add test runner and improve test with multi databases
* Enhance cross-database compatibility and testing
- Fix TRUNCATE command support detection for different databases
- Add conditional PostgreSQL-specific model registration
- Improve database-specific test skipping logic
- Remove SQLite from TRUNCATE supported vendors list
* Add docker compose for testing
* Improve CI/CD with multi-database support
- Add separate test workflows for SQLite, PostgreSQL, and MySQL
* Add `mysqlclient` deps
* fix minor
- Add mysqlclient deps
- upload coverage step
* Fix coverage upload name conflicts in CI workflow
- Add database type to coverage upload names (SQLite/PostgreSQL/MySQL)
* split auditlog HTML render logic from Admin mixin into reusable functions
* add AuditlogHistoryAdminMixin class
* add test cases for auditlog html render functions
* add audit log history view documentation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix minor
* Add missing versionadded and configuration options for AuditlogHistoryAdminMixin
* Add missing test cases
* Update versionadded to 3.2.2 for AuditlogHistoryAdminMixin
* Update CHANGELOG.md
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Debian has moved legacy timezone names such as America/Buenos_Aires into
the tzdata-legacy package, which is not installed by default. The
canonical name for this timezone is America/Argentina/Buenos_Aires,
which remains in the standard tzdata package.
Update the test to use the canonical name to ensure compatibility with
default Debian installations.
* Add support for Django 5.2
* Update setup.py
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* docs: mention Django 5.2 in requirements and changelog
* docs: only keep Django 5.2 support line in changelog improvements
* docs: move and update Django 5.2 changelog entry with PR reference
* Update CHANGELOG.md
---------
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* 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>