Option to assign a tag to a specific or to multiple models #5699

Closed
opened 2025-12-29 19:31:35 +01:00 by adam · 6 comments
Owner

Originally created by @mmfreitas on GitHub (Nov 22, 2021).

NetBox version

v3.0.9

Feature type

Change to existing functionality

Proposed functionality

When creating or editing a tag I think it would be useful to have the option to assign a tag to a specific model or to multiple models.

Something similar to what currently exists in custom fields:

Use case

Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'. Other Tags might be associated to multiple models or even to all models.
Having the option to assign tags to models would also reduce user error when assigning a tag.

Database changes

I assume that adding a field 'content-types' to tags.
Don't know what other changes might be required.

External dependencies

No response

Originally created by @mmfreitas on GitHub (Nov 22, 2021). ### NetBox version v3.0.9 ### Feature type Change to existing functionality ### Proposed functionality When creating or editing a tag I think it would be useful to have the option to assign a tag to a specific model or to multiple models. Something similar to what currently exists in custom fields: ![](https://user-images.githubusercontent.com/91552302/142023845-7b16bd2d-3136-405f-b7a1-814a49b05dfd.png) ### Use case Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'. Other Tags might be associated to multiple models or even to all models. Having the option to assign tags to models would also reduce user error when assigning a tag. ### Database changes I assume that adding a field 'content-types' to tags. Don't know what other changes might be required. ### External dependencies _No response_
adam added the type: feature label 2025-12-29 19:31:35 +01:00
adam closed this issue 2025-12-29 19:31:36 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 22, 2021):

Linking relevant discussion under #7843

@jeremystretch commented on GitHub (Nov 22, 2021): Linking relevant discussion under #7843
Author
Owner

@jeremystretch commented on GitHub (Nov 22, 2021):

Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'.

It sounds like you would likely be better served by using a custom field in these cases.

@jeremystretch commented on GitHub (Nov 22, 2021): > Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'. It sounds like you would likely be better served by using a custom field in these cases.
Author
Owner

@mmfreitas commented on GitHub (Nov 25, 2021):

Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'.

It sounds like you would likely be better served by using a custom field in these cases.

I would like to have this level of customization with tags, but I understand that this is not the way it was intended to be used. So do you confirm that for this to be accomplished there would have to be a lot of unnecessary changes in the database?

@mmfreitas commented on GitHub (Nov 25, 2021): > > Some tags might be only used for ' dcim > devices' others to 'ipam > ip address'. > > It sounds like you would likely be better served by using a custom field in these cases. I would like to have this level of customization with tags, but I understand that this is not the way it was intended to be used. So do you confirm that for this to be accomplished there would have to be a lot of unnecessary changes in the database?
Author
Owner

@rodvand commented on GitHub (Dec 3, 2021):

I get that this isn't a very high priority FR, but if implemented I would utilise it this way:
I use NetBox as the SoT for device and virtual machine objects to Panorama (Palo Alto database). As such I am only interested in tags related to devices, virtual machines, and ip addresses (some selection logic based on tags, and we can use the tags for creating dynamic address groups in Panorama). To make sure I have the tags in Panorama I have to create them first. So every run of this import script I create all the tags in NetBox in Panorama. As we do tag other models in NetBox, a number of unnecessary tags get created in Panorama. Not a big issue, but if I got to choose I would only create the tags related to device, virtual machine and IP address models.

@rodvand commented on GitHub (Dec 3, 2021): I get that this isn't a very high priority FR, but if implemented I would utilise it this way: I use NetBox as the SoT for device and virtual machine objects to Panorama (Palo Alto database). As such I am only interested in tags related to devices, virtual machines, and ip addresses (some selection logic based on tags, and we can use the tags for creating dynamic address groups in Panorama). To make sure I have the tags in Panorama I have to create them first. So every run of this import script I create all the tags in NetBox in Panorama. As we do tag other models in NetBox, a number of unnecessary tags get created in Panorama. Not a big issue, but if I got to choose I would only create the tags related to device, virtual machine and IP address models.
Author
Owner

@jeremystretch commented on GitHub (Dec 8, 2021):

Sorry, I'm not seeing any real justification for this, and it would be fairly burdensome to implement. And again, this is exactly the use case custom fields are intended to address.

As we do tag other models in NetBox, a number of unnecessary tags get created in Panorama.

@rodvand why not just query for tags by assigned content type? For example, /api/extras/tags/?content_type=dcim.device will return only tags that are assigned to devices.

@jeremystretch commented on GitHub (Dec 8, 2021): Sorry, I'm not seeing any real justification for this, and it would be fairly burdensome to implement. And again, this is exactly the use case custom fields are intended to address. > As we do tag other models in NetBox, a number of unnecessary tags get created in Panorama. @rodvand why not just query for tags by assigned content type? For example, `/api/extras/tags/?content_type=dcim.device` will return only tags that are assigned to devices.
Author
Owner

@rodvand commented on GitHub (Dec 8, 2021):

@rodvand why not just query for tags by assigned content type? For example, /api/extras/tags/?content_type=dcim.device will return only tags that are assigned to devices.

Didn't know I could do that, so that's why 😄 Guess I have some tags to delete now (exciting stuff!).

@rodvand commented on GitHub (Dec 8, 2021): > @rodvand why not just query for tags by assigned content type? For example, `/api/extras/tags/?content_type=dcim.device` will return only tags that are assigned to devices. Didn't know I could do that, so that's why 😄 Guess I have some tags to delete now (exciting stuff!).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5699