django-auditlog/auditlog_tests
Lukas Graf d02ed6b9e0
Make diffing more robust for polymorphic models (#784)
* 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.
2025-11-25 09:12:41 +01:00
..
custom_logentry_app Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
docker/db Extend CI and local test coverage to MySQL and SQLite (#744) 2025-08-17 16:50:23 +02:00
test_app Make diffing more robust for polymorphic models (#784) 2025-11-25 09:12:41 +01:00
__init__.py Remove default_app_config configuration 2022-05-02 14:48:58 +02:00
admin.py Use admin for test site 2020-09-07 16:52:32 +02:00
auditlog Add base manager setting to override default manager use (#747) (#766) 2025-10-18 13:55:43 +02:00
docker-compose.yml Update mysql version in test docker-compose (#777) 2025-10-31 14:53:16 +01:00
manage.py Let CI also check for missing migrations (#706) 2025-03-19 19:58:43 +03:30
middleware.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_commands.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_postgresql.py Extend CI and local test coverage to MySQL and SQLite (#744) 2025-08-17 16:50:23 +02:00
test_render.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_settings.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_two_step_json_migration.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_use_json_for_changes.py Add CustomLogEntry model support and update tests: (#764) 2025-11-19 09:46:43 +01:00
test_view.py Add audit log history view to Django Admin (#743) 2025-08-05 13:02:43 +02:00
tests.py Make diffing more robust for polymorphic models (#784) 2025-11-25 09:12:41 +01:00