[PR #5924] [MERGED] Fixes #5913: Improve change logging #13066

Closed
opened 2025-12-29 22:25:13 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5924
Author: @jeremystretch
Created: 3/4/2021
Status: Merged
Merged: 3/4/2021
Merged by: @jeremystretch

Base: featureHead: 5913-change-logging


📝 Commits (7)

📊 Changes

21 files changed (+439 additions, -124 deletions)

View changed files

📝 docs/additional-features/change-logging.md (+1 -1)
📝 docs/release-notes/version-2.11.md (+7 -0)
📝 netbox/circuits/migrations/0025_standardize_models.py (+10 -0)
📝 netbox/circuits/models.py (+5 -13)
📝 netbox/dcim/models/device_component_templates.py (+1 -7)
📝 netbox/dcim/models/device_components.py (+1 -7)
📝 netbox/extras/api/serializers.py (+1 -1)
netbox/extras/migrations/0055_objectchange_data.py (+28 -0)
📝 netbox/extras/models/change_logging.py (+12 -4)
📝 netbox/extras/signals.py (+6 -0)
📝 netbox/extras/tests/test_changelog.py (+222 -33)
📝 netbox/extras/tests/test_filters.py (+6 -6)
📝 netbox/extras/views.py (+8 -6)
📝 netbox/ipam/models/ip.py (+1 -7)
📝 netbox/netbox/api/views.py (+24 -0)
📝 netbox/netbox/models.py (+20 -14)
📝 netbox/netbox/views/generic.py (+34 -7)
📝 netbox/templates/extras/objectchange.html (+31 -3)
📝 netbox/utilities/utils.py (+7 -5)
📝 netbox/virtualization/migrations/0020_standardize_models.py (+10 -0)

...and 1 more files

📄 Description

Fixes: #5913

  • Extend the ObjectChange model to include both prechange_data and postchange_data
  • Add a snapshot() method to the ChangeLoggingMixin class
  • Extend the UI and API views to secure a snapshot of existing data before each object is edited/deleted
  • Highlight changes when displaying the diff between pre- and post-change data in the UI
  • Add relevant changelog tests

This work also makes possible the implementation of #3451


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/5924 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 3/4/2021 **Status:** ✅ Merged **Merged:** 3/4/2021 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `5913-change-logging` --- ### 📝 Commits (7) - [`71bd16c`](https://github.com/netbox-community/netbox/commit/71bd16c16a23a934b84fc30253d1fc95047debdb) Initial work on #5913 - [`36e4cb4`](https://github.com/netbox-community/netbox/commit/36e4cb430c45070e4184cc9d14d06f8692545f9e) Provide per-line diff highlighting - [`8889cd8`](https://github.com/netbox-community/netbox/commit/8889cd829634a27f1b79b3dabbdab989a6b155c4) BulkDeteView should delete objects individually to secure a pre-change snapshot - [`09b0a5d`](https://github.com/netbox-community/netbox/commit/09b0a5d1ca0db1aabb9fa0cb7725439814d8e6fe) Add changelog tests for bulk operations - [`5df72a2`](https://github.com/netbox-community/netbox/commit/5df72a2b6dac9d8527778f5070caee7c7b05b240) Troubleshooting test failure in CI - [`7dbba82`](https://github.com/netbox-community/netbox/commit/7dbba821ba2cd43d01e5a8cfdf81300c1153709a) Fix permissions error in test_bulk_edit_objects() - [`b48546f`](https://github.com/netbox-community/netbox/commit/b48546f07a8a55d7ece26ced40ef082d48aa628b) Move view permission to the correct test ### 📊 Changes **21 files changed** (+439 additions, -124 deletions) <details> <summary>View changed files</summary> 📝 `docs/additional-features/change-logging.md` (+1 -1) 📝 `docs/release-notes/version-2.11.md` (+7 -0) 📝 `netbox/circuits/migrations/0025_standardize_models.py` (+10 -0) 📝 `netbox/circuits/models.py` (+5 -13) 📝 `netbox/dcim/models/device_component_templates.py` (+1 -7) 📝 `netbox/dcim/models/device_components.py` (+1 -7) 📝 `netbox/extras/api/serializers.py` (+1 -1) ➕ `netbox/extras/migrations/0055_objectchange_data.py` (+28 -0) 📝 `netbox/extras/models/change_logging.py` (+12 -4) 📝 `netbox/extras/signals.py` (+6 -0) 📝 `netbox/extras/tests/test_changelog.py` (+222 -33) 📝 `netbox/extras/tests/test_filters.py` (+6 -6) 📝 `netbox/extras/views.py` (+8 -6) 📝 `netbox/ipam/models/ip.py` (+1 -7) 📝 `netbox/netbox/api/views.py` (+24 -0) 📝 `netbox/netbox/models.py` (+20 -14) 📝 `netbox/netbox/views/generic.py` (+34 -7) 📝 `netbox/templates/extras/objectchange.html` (+31 -3) 📝 `netbox/utilities/utils.py` (+7 -5) 📝 `netbox/virtualization/migrations/0020_standardize_models.py` (+10 -0) _...and 1 more files_ </details> ### 📄 Description ### Fixes: #5913 - Extend the ObjectChange model to include both `prechange_data` and `postchange_data` - Add a `snapshot()` method to the ChangeLoggingMixin class - Extend the UI and API views to secure a snapshot of existing data before each object is edited/deleted - Highlight changes when displaying the diff between pre- and post-change data in the UI - Add relevant changelog tests This work also makes possible the implementation of #3451 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:25:13 +01:00
adam closed this issue 2025-12-29 22:25:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13066