mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 16:47:34 -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
2a44affd03
commit
b5bc0bad38
@ -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