Get tags applied to a device via nbshell #16360
-
Context: I'm trying to make a validator for a contact assignment that checks to see if the object the contact assignment is being made on has a specific tag applied. AKA: if tag not in parent.tags: fail I can't seem to figure out how to do this without making an internal api call whcih I'd like to avoid because it seems unnecessary. In nbshell I can get the device object but when looking at the model I don't see any kind of tag property. So I'm not sure what I should be trying to do to accomplish this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It would have been helpful if you had shown the actual python code you tried, and the actual response.
If you are looking for a specific tag then there is a simpler approach:
|
Beta Was this translation helpful? Give feedback.
It would have been helpful if you had shown the actual python code you tried, and the actual response.
tags
is not a list or queryset, it's a database manager object.tags.all()
will give you a queryset, which you can convert into a list if you want or construct anin
query. Note that the tags themselves are are objects.If you are looking for a specific tag then there is a sim…