Commit graph

641 commits

Author SHA1 Message Date
Cleiton de Lima
6cfd57c31f Added remote port (#671) 2025-10-21 18:02:25 +02:00
Cleiton de Lima
c6b95537fa Added --no-color args in test migration (#670) 2025-10-21 17:52:46 +02:00
Mohsin Raza
f607d547ec update docs (#662) 2025-10-21 17:52:42 +02:00
Hasan Ramezani
9e7771fab1 Update postgres to 14 (#649) 2025-10-21 17:52:21 +02:00
Hasan Ramezani
43f667aaa4 Fixed problem when setting django.db.models.functions.Now() in DateTimeField (#635) 2025-10-21 17:52:04 +02:00
Hasan Ramezani
04b639fe8c Prepare release 3.0.0 (#629) 2025-10-21 17:51:56 +02:00
Hasan Ramezani
c2e3ad3f16 Fixed manuall logging when model is not registered (#627)
* Fixed manuall logging when model is not registered

* Move change log
2025-10-21 17:51:48 +02:00
Hasan Ramezani
f1f9020347 Add note about V3 to readme (#626) 2025-10-21 17:43:30 +02:00
nathan
d9db2c991b 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>
2025-10-21 17:43:23 +02:00
Paul Morin
a3bdcf77be 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
2025-10-21 17:43:08 +02:00
dependabot[bot]
0133c2d964 Bump the github-actions group with 4 updates (#619)
Bumps the github-actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-python](https://github.com/actions/setup-python), [actions/cache](https://github.com/actions/cache) and [codecov/codecov-action](https://github.com/codecov/codecov-action).

Updates `actions/checkout` from 3 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

Updates `actions/setup-python` from 3 to 5
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3...v5)

Updates `actions/cache` from 3 to 4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

Updates `codecov/codecov-action` from 3 to 4
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-21 17:43:00 +02:00
Christian Clauss
fa77144de6 Keep GitHub Actions up to date with GitHub's Dependabot (#618)
Fixes warnings like at the bottom right of
https://github.com/jazzband/django-auditlog/actions/runs/8332793947

* https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
* https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
2025-10-21 17:42:12 +02:00
Pascal Mathis
23dcd22371 fix: avoid exception in changes_display_dict when model is missing (#609) 2025-10-21 17:42:05 +02:00
pre-commit-ci[bot]
f11e1391a3 [pre-commit.ci] pre-commit autoupdate (#601)
updates:
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:34:37 +02:00
Hasan Ramezani
97dbc62a2a Prepare release 3.0.0-beta.4 (#599) 2025-10-21 17:34:20 +02:00
Hasan Ramezani
5f6af97fb3 Confrim Django 5.0 and drop django 4.1 (#598) 2025-10-21 17:33:46 +02:00
pre-commit-ci[bot]
fa5aea3721 [pre-commit.ci] pre-commit autoupdate (#595)
updates:
- [github.com/psf/black: 23.11.0 → 23.12.0](https://github.com/psf/black/compare/23.11.0...23.12.0)
- [github.com/PyCQA/isort: 5.13.0 → 5.13.2](https://github.com/PyCQA/isort/compare/5.13.0...5.13.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:32:45 +02:00
pre-commit-ci[bot]
71e6bdca0b [pre-commit.ci] pre-commit autoupdate (#594)
updates:
- [github.com/PyCQA/isort: 5.12.0 → 5.13.0](https://github.com/PyCQA/isort/compare/5.12.0...5.13.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:32:27 +02:00
Hasan Ramezani
e33c10ee9a Prepare release 3.0.0-beta.3 (#587) 2025-10-21 17:32:08 +02:00
hamsh
500c872d85 use contextvar instead of threadlocal (#581)
* use contextvar instead of threadlocal

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update auditlog/context.py

* 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>
2025-10-21 17:31:46 +02:00
pre-commit-ci[bot]
bfe1565d76 [pre-commit.ci] pre-commit autoupdate (#579)
updates:
- [github.com/psf/black: 23.10.0 → 23.10.1](https://github.com/psf/black/compare/23.10.0...23.10.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:29:54 +02:00
Abdullah Alaqeel
72d96242a7 fix: change verbose_name in changes_text migration (#571) 2025-10-21 17:29:07 +02:00
Hasan Ramezani
afe55bc35f Update pre-commit repos (#569) 2025-10-21 17:28:54 +02:00
Hasan Ramezani
57dbefd48c Update postgres to 13 (#568) 2025-10-21 17:28:28 +02:00
Abdullah Alaqeel
6f7a758a48 fix: don't set the correlation_id if the AUDITLOG_CID_GETTER is None (#565) 2025-10-21 17:28:06 +02:00
pre-commit-ci[bot]
e1485104f8 [pre-commit.ci] pre-commit autoupdate (#564)
updates:
- [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:24:15 +02:00
pre-commit-ci[bot]
3dbf6a3727 [pre-commit.ci] pre-commit autoupdate (#562)
updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 17:21:15 +02:00
Abdullah Alaqeel
b6e5223bf3 chore: add a check arg to the migration command (#563)
* chore: add a check arg to the migration command

* chore: add a check arg to the migration command
2025-10-21 17:20:45 +02:00
James Gillard
68fe1cbed9 Confirm Python 3.12 support (#572)
* Confirm Python 3.12 support

* Remove dj4.2/py3.12 from tox.ini
2025-10-21 17:18:46 +02:00
Abdullah Alaqeel
4a36378f3c feat: give users the option to run the json migration asyncly (#495) 2025-10-21 17:17:38 +02:00
Abdullah Alaqeel
73800bb34c feat: collect all models including auto created ones and excluding non-managed ones (#550)
feat: automatically register m2m fields for models when opting to auto register models
2025-10-21 11:47:20 +02:00
pre-commit-ci[bot]
5e8f856e13 [pre-commit.ci] pre-commit autoupdate (#547)
updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-21 11:47:13 +02:00
Hasan Ramezani
78dc7a5012 Fix a bug in serialized_data with F expressions (#544) 2025-10-21 11:46:50 +02:00
Fırat Kılıç
188337b465 Fix unnecessary log when adding already existed m2m record (#535) 2025-10-21 11:46:44 +02:00
Rustam Astafeev
a5f54d09df fixed getting field's verbose_name (#508)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2025-10-21 11:46:04 +02:00
Joey Lange
a893859886 Make M2M changes comply with JSONField properly (#514) 2025-10-21 11:30:22 +02:00
Aaron C. de Bruyn
81a6cf2344 Add ability to globally exclude fields by name on all models (#498)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2025-10-21 11:26:26 +02:00
Abdullah Alaqeel
1cecc8ca80 Always call set_actor (#484) 2025-10-21 11:23:35 +02:00
Thomas Steen Rasmussen
fb6c363e2c raise AuditLogRegistrationError on invalid app in settings (#492)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2025-10-21 11:13:52 +02:00
Cleiton de Lima
4a56697422 Fix repr of a json field in field changes (#489) 2025-10-21 11:11:43 +02:00
Aivars Kalvāns
a41c0f852d Convert AUDITLOG_EXCLUDE_TRACKING_MODELS to tuple before concatenate (#488) 2025-10-21 11:10:49 +02:00
August Raack
2bd6c1a3e8 Modify `change` field to be a json field. (#407)
* Modify ``change`` field to be a json field.

Storing the object changes as a json is preferred because it allows SQL
queries to access the change values. This work moves the burden of
handling json objects from an implementation of python's json library in
this package and puts it instead onto the ORM. Ultimately, having the
text field store the changes was leaving them less accessible to external
systems and code that is written outside the scope of the django
auditlog.

This change was accomplished by updating the field type on the model and
then removing the JSON dumps invocations on write and JSON loads
invocations on read. Test were updated to assert equality of
dictionaries rather than equality of JSON parsable text.

Separately, it was asserted that postgres will make these changes to
existing data. Therefore, existing postgres installations should update the
type of existing field values without issue.

* Add test coverage for messages exceeding char len

The "Modify change field to be a json field" commit reduced test
coverage on the mixins.py file by 0.03%. The reduction in coverage was
the result of reducing the number of operations required to achieve the
desired state. An additional test was added to increase previously
uncovered code. The net effect is an increase in test case coverage.

* Add line to changelog

Better markdown formatting

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* Update CHANGELOG text format

More specific language in the improvement section regarding `LogEntry.change`

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* Update migration to show Django version 4.0

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* Update CHANGELOG to show breaking change

Running the migration to update the field type of `LogEntry.change` is a breaking change.

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* Update serial order of migrations

* Adjust manager method for compatibility

The create log method on the LogEntry manager required an additional
kwarg for a call to create an instance regardless of a change or not.
This felt brittle anyway. The reason it had worked prior to these
changes was that the `change` kwarg was sending a string "null" and
not a None when there were no changes.

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2025-10-21 11:04:47 +02:00
Abdullah Alaqeel
b8cdfb0dbb Adding Custom Pre- and Post- Log Hooks (#483) 2025-10-21 10:38:15 +02:00
Aleh Rymašeŭski
0807b8f216 Allow @auditlog.register with no parentheses 2023-10-24 11:55:26 +00:00
Hasan Ramezani
ca3806f296 Drop support for Python 3.7 (#546) 2023-09-01 15:53:44 +00:00
Aleh Rymašeŭski
408a105fe1 Allow cascade deletion of auditlog entries (#556)
* Allow cascade deletion of auditlog entries

* Cache iteration over self.urls
2023-09-01 15:50:51 +00:00
Aleh Rymašeŭski
ab65364bb4 Set history delete_related to False by default (#557)
This is a breaking change. The default behavior is to delete the
related objects, but it doesn't make sense to apply it to audit log
entries, at least not by default.
2023-09-01 15:50:08 +00:00
Aleh Rymašeŭski
47188b46d7 Stop deleting log entries in log_create 2023-09-01 15:48:59 +00:00
Aleh Rymašeŭski
682e8e270b Add null=True to LogEntry.cid field
It's already set nullable in the migration.
2023-07-19 10:15:27 +00:00
Aleh Rymašeŭski
03920f2874 Merge tox & CI changes from upstream master 2023-07-13 16:48:37 +00:00