mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
Fix serialization of custom_fields for change logging
This commit is contained in:
parent
0c737ec1c0
commit
e3e8b66450
@ -91,11 +91,9 @@ def serialize_object(obj, extra=None, exclude=None):
|
|||||||
json_str = serialize('json', [obj])
|
json_str = serialize('json', [obj])
|
||||||
data = json.loads(json_str)[0]['fields']
|
data = json.loads(json_str)[0]['fields']
|
||||||
|
|
||||||
# Include any custom fields
|
# Include custom_field_data as "custom_fields"
|
||||||
if hasattr(obj, 'get_custom_fields'):
|
if hasattr(obj, 'custom_field_data'):
|
||||||
data['custom_fields'] = {
|
data['custom_fields'] = data.pop('custom_field_data')
|
||||||
field: str(value) for field, value in obj.cf.items()
|
|
||||||
}
|
|
||||||
|
|
||||||
# Include any tags. Check for tags cached on the instance; fall back to using the manager.
|
# Include any tags. Check for tags cached on the instance; fall back to using the manager.
|
||||||
if is_taggable(obj):
|
if is_taggable(obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user