1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fix serialization of tags for REST API updates

This commit is contained in:
Jeremy Stretch
2020-08-17 16:18:47 -04:00
parent cf086cd7b2
commit 0e5d0a43f9
3 changed files with 37 additions and 10 deletions

View File

@@ -97,9 +97,10 @@ def serialize_object(obj, extra=None, exclude=None):
field: str(value) for field, value in obj.cf.items()
}
# Include any tags
# Include any tags. Check for tags cached on the instance; fall back to using the manager.
if is_taggable(obj):
data['tags'] = [tag.name for tag in obj.tags.all()]
tags = getattr(obj, '_tags', obj.tags.all())
data['tags'] = [tag.name for tag in tags]
# Append any extra data
if extra is not None: