-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintain a list of modified fields on each instance of a change-logged model #9902
Comments
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. |
Incidentally I needed something just like the functionality described just yesterday. The solution I found most useful for my purposes is this:
Maybe it's useful as a starting point. The main advantage is that this works for any model without changes, and just initializes the class attribute This implementation returns a set instead of a list, but that's just because it made more sense in my use case. |
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.
snapshot()
on each instance in a view: This can be handled automatically on the first change to a field.CableTermination
not updated #9788).Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: