mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Include custom fields in ObjectChange data
This commit is contained in:
parent
06dab9c468
commit
f5f16ce64b
@ -93,6 +93,15 @@ def serialize_object(obj, extra=None):
|
||||
"""
|
||||
json_str = serialize('json', [obj])
|
||||
data = json.loads(json_str)[0]['fields']
|
||||
|
||||
# Include any custom fields
|
||||
if hasattr(obj, 'get_custom_fields'):
|
||||
data['custom_fields'] = {
|
||||
field.name: value for field, value in obj.get_custom_fields().items()
|
||||
}
|
||||
|
||||
# Append any extra data
|
||||
if extra is not None:
|
||||
data.update(extra)
|
||||
|
||||
return data
|
||||
|
Loading…
Reference in New Issue
Block a user