Explorar o código

Record tags when serializing an object for an ObjectChange

Jeremy Stretch %!s(int64=7) %!d(string=hai) anos
pai
achega
289a762bf1
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      netbox/utilities/utils.py

+ 4 - 0
netbox/utilities/utils.py

@@ -100,6 +100,10 @@ def serialize_object(obj, extra=None):
             field.name: value for field, value in obj.get_custom_fields().items()
         }
 
+    # Include any tags
+    if hasattr(obj, 'tags'):
+        data['tags'] = [tag.name for tag in obj.tags.all()]
+
     # Append any extra data
     if extra is not None:
         data.update(extra)