Commit graph

57 commits

Author SHA1 Message Date
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
Hasan Ramezani
78dc7a5012 Fix a bug in serialized_data with F expressions (#544) 2025-10-21 11:46:50 +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
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
Cleiton de Lima
4a56697422 Fix repr of a json field in field changes (#489) 2025-10-21 11:11:43 +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
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
addaaa7d68 Merge cid from upstream 2023-07-13 15:56:59 +00:00
Aleh Rymašeŭski
117696842b Merge overwritable timestamp from upstream 2023-07-13 15:53:37 +00:00
Aleh Rymašeŭski
779a751da3 Skip upstream version 2.2.2
We are not subject to the regressions this revert addresses.
2023-07-13 15:44:37 +00:00
Hasan Ramezani
2595a36c71
Prepare release 2.2.2 (#497) 2023-01-17 09:07:11 +01:00
Alieh Rymašeŭski
6996e1cfd4
Revert "Disallow changing or deleting log entries" (#496)
This reverts commit de5638c607.
2023-01-16 16:04:51 +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
Abdullah Alaqeel
a733cd0852
feat: Make timestamp in LogEntry overwritable (#478) 2022-12-19 08:43:29 +01:00
Thomas Steen Rasmussen
27f57a53ff
Fix LogEntry.changes_dict() to return {} when json.loads() returns None (#472)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-12-13 21:35:31 +01:00
Hasan Ramezani
2a93c2086a
Prepare release 2.2.1 (#459) 2022-11-28 13:39:30 +03:00
Abdullah Alaqeel
4cdc756791
FIX: Parsing client IPv6 address when a proxy is involved (#457) 2022-11-22 08:44:59 +01:00
Alieh Rymašeŭski
1ba3bd9d07
Disallow changing or deleting log entries (#449) 2022-11-21 16:26:23 +01:00
Hasan Ramezani
227b0d9fb5
Prepare release 2.2.0 (#434) 2022-11-07 14:48:05 +01:00
Hasan Ramezani
2b0bc9efa2
Replace the django.utils.timezone.utc by datetime.timezone.utc (#448)
Co-authored-by: Alieh Rymašeŭski <alieh.rymasheuski@gmail.com>
2022-11-07 14:26:51 +01:00
Hasan Ramezani
36eaaaa2a9
Confirm Python 3.11 support (#447) 2022-11-07 09:36:17 +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
Alieh Rymašeŭski
0f57525058
Support search by custom USERNAME_FIELD (#432) 2022-09-21 16:19:49 +02:00
Rahul Prasad
a56d0e6f78
added fix for OneToOneRel error happening in case of Polymorphic model (#429) 2022-09-21 08:53:10 +02:00
Mathieu Rampant
d74c118834
Added verbose field name in admin (#428)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-09-20 22:07:41 +02:00
August Raack
777bd537e7
Add serialized object field (#412) 2022-08-21 21:45:50 +02:00
Hasan Ramezani
18868aaaed Handle port in remote_addr 2022-08-17 13:37:22 +02:00
Hasan Ramezani
1cd7d9839d
Confirm Django 4.1 support (#406) 2022-08-03 17:26:56 +02:00
Alieh Rymašeŭski
a24b79af0c
Display timestamps in server timezone (#404) 2022-08-01 20:41:41 +02:00
Hasan Ramezani
68cde8ffb9 Prepare release 2.1.1 2022-07-27 22:19:51 +02:00
Alieh Rymašeŭski
f68af3033d
Pin python-dateutil>=2.7.0 (#401) 2022-07-27 20:18:29 +02:00
Alieh Rymašeŭski
7861dae4f9 Show field values before deletion in the admin 2022-06-30 09:04:43 +02:00
Hasan Ramezani
4f4699bf6b Prepare release 2.1.0 2022-06-27 23:36:15 +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
Youngkwang Yang
957680e239
Fix n+1 query problem (#381) 2022-05-31 20:05:43 +09:00
George Leslie-Waksman
1e7d320a93
Add an index to the timestamp column (#364)
Many queries, including the default ordering, for the LogEntry
model rely on the timestamp field. Adding an index will ensure
reasonable scalability for large audit logs.
2022-05-31 09:01:13 +02:00
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
Saurabh Kumar
cdd9f40d84 Disable add button in admin ui
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-05-20 22:13:47 +02:00
Christian Barra
a93f53962a
Skip stringify if json (#355)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-05-10 05:53:18 +02:00
Hasan Ramezani
d848c53d08 Prepare release of django-auditlog 2.0.0 2022-05-09 08:53:21 +02:00