netbox
netbox copied to clipboard
Maintain a list of modified fields on each instance of a change-logged model
NetBox version
v3.3-beta1
Feature type
New functionality
Proposed functionality
Implement a mechanism for tracking which attributes (if any) of a pre-existing instance have been modified from their original values. For example, when retrieving a site object from the database and then modifying the instance's name, automatically flag the name field as having been modified. This can be done by defining a list of fields named _changed_fields on the instance.
Use case
Being able to infer which fields of an instance have been modified unlocks some very interesting potential.
- It obviates the need to manually call
snapshot()on each instance in a view: This can be handled automatically on the first change to a field. - It enables responsive updates of denormalized (cached) database fields on other models (see #9788).
Database changes
No response
External dependencies
No response
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
A variation of the approach described above has been implemented as part of #6347 (cached device & VM component counts) for NetBox v3.6. We can likely iterate on that work to achieve a more general purpose solution.