Cover multi-table inheritance in change logged models #18277
Labels
status: needs triage
This issue is awaiting triage by a maintainer
type: feature
Introduction of new functionality to the application
NetBox version
v4.1.10
Feature type
Change to existing functionality
Triage priority
I volunteer to perform this work (if approved)
Proposed functionality
Currently the
serialize_object()
utility function checks if the model has thecustom_field_data
attribute.netbox/netbox/utilities/serialization.py
Lines 32 to 33 in f03489f
I suggest changing this to check if the key actually exists in the
data
dictionary.Use case
A plugin could extend existing NetBox models using multi-table inheritance. However, although the attribute is available on the child model class, the data is actually stored in the parent model. Serializing the object during the automatic creation of the
ObjectChange
will therefore raise an exception, as the attribute is available, but won't be serialized in thedata
dictionary.Although NetBox should not cover serialization for this scenario, changing this would allow plugins more possibilities. NetBox simply wouldn't handle this attribute in this scenario, leaving it to the developer to implement. No exceptions will be thrown either.
Database changes
None
External dependencies
None
The text was updated successfully, but these errors were encountered: