mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Cover multitable inheritance in serialization
During serialization, custom fields may be available to a model due to multi-table inheritance, but might not be available in serialized data because only direct fields of the model are covered. Now this attribute is only used if available in serialized data. Models using multi-table inheritance must modify their serialize_object() method to cover parent serialization.
This commit is contained in:
parent
35110beec4
commit
51617ae11b
@ -29,7 +29,7 @@ def serialize_object(obj, resolve_tags=True, extra=None, exclude=None):
|
||||
exclude = exclude or []
|
||||
|
||||
# Include custom_field_data as "custom_fields"
|
||||
if hasattr(obj, 'custom_field_data'):
|
||||
if 'custom_field_data' in data:
|
||||
data['custom_fields'] = data.pop('custom_field_data')
|
||||
|
||||
# Resolve any assigned tags to their names. Check for tags cached on the instance;
|
||||
|
Loading…
Reference in New Issue
Block a user