Commit graph

40 commits

Author SHA1 Message Date
Fabian Allendorf
eb9eefd76f
Add new setting to control FK change representation (#779)
* 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
2025-12-02 16:49:16 +01:00
mostafaeftekharizadeh
7d13fd4ba8
Add CustomLogEntry model support and update tests: (#764)
* 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>
2025-11-19 09:46:43 +01:00
David Thompson
b1b6f9f4dd
Add base manager setting to override default manager use (#747) (#766)
* 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.
2025-10-18 13:55:43 +02:00
Matt Cengia
74ba152a67
Fix copy-paste error in documentation heading (#760) 2025-10-10 10:57:42 +02:00
Youngkwang Yang
9ef8cf2476
Add audit log history view to Django Admin (#743)
* 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>
2025-08-05 13:02:43 +02:00
Youngkwang Yang
af78976e53
Add support for custom masking functions (#725)
* 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>
2025-06-09 16:59:59 +03:30
The Alchemist
b640df67a3
new setting: STORE_JSON_CHANGES that intelligently store JSON (#719)
* 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>
2025-04-30 11:20:27 +02:00
Amirreza Ashouri
c4907bcd52
Add ability to globally mask fields by name on all models. (#702)
* 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.
2025-02-24 12:05:04 +03:30
Hoàng Quốc Hưng
d4f99c2729
Add AUDITLOG_TRUNCATE_CHANGES_DISPLAY and AUDITLOG_TRUNCATE_LIMIT (#684)
* 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
2024-11-04 14:39:25 +01:00
Mohsin Raza
07a3a83828
update docs (#662) 2024-08-01 12:03:40 +03:30
nathan
a0ae594425
Disable logging remote IP address (#620)
* 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>
2024-03-31 01:37:39 +01:00
Paul Morin
b2aff7e313
Correcting a typo in usage.rst (#615)
The code example for AUDITLOG_INCLUDE_TRACKING_MODELS made two distinct references to "model1" which seems to be a typo, should read "model2" on the second reference
2024-03-20 20:20:41 +01:00
Aaron C. de Bruyn
06ae048378
Add ability to globally exclude fields by name on all models (#498)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2023-01-20 15:41:36 +01:00
Abdullah Alaqeel
bc6d393390
Added support for Correlation ID
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-12-23 15:09:32 +01:00
Youngkwang Yang
96275d5386
Add serialize_data setting (#452) 2022-11-15 13:05:35 +01:00
Simon Kern
f71699a9d0
Added ACCESS action and enabled logging of object accesses (#436) 2022-11-07 08:51:00 +01:00
Robin Harms Oredsson
8fe776ae45
Option to disable logging on raw save and via context manager (#446)
* Disable on raw save prototype
* Contextmanager to disable instead of just raw - so we can catch m2m relations too
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-11-04 09:12:06 +01:00
August Raack
777bd537e7
Add serialized object field (#412) 2022-08-21 21:45:50 +02:00
Hasan Ramezani
830152f0f4 Fix code block in usage.rst 2022-08-05 15:29:01 +03:00
Hasan Ramezani
6b60d04e44 Fix documentation problem in usage.rst 2022-06-28 19:19:09 +02:00
Alieh Rymašeŭski
10c47181bb
Add logic to track changes to m2m fields (#309) 2022-06-08 17:09:27 +02:00
George Leslie-Waksman
128555fa29
Add date based auditlog filter for auditlogflush command (#365) 2022-05-31 21:35:50 +04:30
Alieh Rymašeŭski
bcd0d43566
Add set_actor context manager (#262) 2022-05-24 09:33:54 +02:00
yeongkwang
32694b1324
Add register model using Django settings (#368)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-05-23 10:02:22 +02:00
Hasan Ramezani
6f82d070a9 Change versionadded in masking fields documentation. 2022-05-09 13:40:31 +02:00
yeongkwang
8d8b6bad30 Fix small typo 2022-03-23 14:48:31 +04:30
Amin Alaee
bb5f99533e
Add mask_fields argument in register (#310)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-03-10 14:17:50 +01:00
Hasan Ramezani
e2913da1bb Replace MIDDLEWARE_CLASSES with MIDDLEWARE in docs. 2021-06-03 13:23:11 +02:00
Blas Isaias Fernández
55a66fc73a dict.iteritems was removed from python 3 2021-05-24 11:26:11 +02:00
Jan-Jelle Kester
f4edfc0592 Management command improvements 2020-09-07 16:52:32 +02:00
Ryan Castner
45760c6316 Fixes #93 - Add 'changes_display_dict' property to 'LogEntry' model to display diff in a more human readable format (#94)
Fixes #93 - Add 'changes_display_dict' property to 'LogEntry' model to display diff in a more human readable format

'changes_display_dict' currently handles fields with choices, long textfields and charfields, datefields, timefields, and datetimefields. Supports `django-multiselectfield` with choices and Postgres's ArrayField with choices.

Textfields and Charfields longer than 140 characters are truncated with an ellipsis appended.
Date, Time and DateTime fields are rendered according to `L10N`, or if turned off fall back on Django settings defaults for DATE_FORMAT, TIME_FORMAT and DATETIME_FORMAT.

A new kwarg was added to 'AuditlogModelRegistry' called 'mapping_fields'. The kwarg allows the user to map the fields in the model to a more human readable or intuitive name. If a field isn't mapped it will default to the `verbose_name` as defined on the model or the Django default `verbose_name`. Partial mapping is supported, all fields do not need to be mapped to use the feature.

* Add django-multiselectfield test dep

* Add psycopg2 test dep

* Add postgres testing database and router

* Add postgres support to travis builds

* Add support for multiple databases. LogEntry saves to same database of the model its associated to

* If any literal evals fail default to None

* Add support for Postgres ArrayField in changes_display_dict

* Revert to old travis image while they are fixing issues with it

* Update docs

* Add full test coverage
2017-09-13 10:57:47 -04:00
Jan-Jelle Kester
12d8c4d84d Version bump and slight doc changes for 0.4.1 2016-12-27 11:08:12 +01:00
Jan-Jelle Kester
182c3f69a6 Add management command for deleting all log entries
Issue #57
2016-07-27 18:24:04 +02:00
Jan-Jelle Kester
cfd6b35d6c Extend docs with many-to-many, manual logging 2015-07-22 01:16:58 +02:00
Jan-Jelle Kester
dab0342cf6 Merge branch 'master' into release-0.3.0
Conflicts:
	src/auditlog/diff.py
2015-07-22 01:06:32 +02:00
Jan-Jelle Kester
c40ae32955 Update documentation for new feature 2015-06-03 16:50:00 +02:00
Jan-Jelle Kester
83c8dc7dcf Fix syntax highlighting on usage page 2015-05-15 01:43:01 +02:00
Jan-Jelle Kester
1161324837 Update documentation for 0.3.0 release 2015-05-15 00:56:01 +02:00
Jan-Jelle Kester
4606f614a8 Add South compatibility to docs 2014-07-08 17:34:12 +02:00
Jan-Jelle Kester
1b95c89ca2 Work on documentation 2013-12-12 17:57:29 +01:00