Apply multiple instances of a custom field to an object #4516

Closed
opened 2025-12-29 18:36:54 +01:00 by adam · 1 comment
Owner

Originally created by @ggiesen on GitHub (Jan 29, 2021).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.10.2

Proposed Functionality

The current implementation of custom fields only allows for a single value. I propose that we allow to add multiple instances of a custom field much the same tags can be applied to almost anything

Use Case

To add static routes on a device, I currently use a custom field attached to an interface IP using the following format:

<prefix>/<prefixlen> via gateway[,<prefix>/<prefixlen> via gateway]

Example:

192.0.2.0/24 via 203.0.113.1,198.51.100.0/24 via 203.0.113.1

This is currently cumbersome for a few reasons:

  1. The field length is limited
  2. It can be hard to create, read, and edit for large numbers of values
  3. It's hard to validate

Instead, it would be cleaner to be able to add multiple instances of a custom field such that each value could be added, edited, removed, and validated individually.

ie.

  1. 192.0.2.0/24 via 203.0.113.1
  2. 198.51.100.0/24 via 203.0.113.1

Database Changes

I would imagine new tables need to be created for the new 1:M relationships.

External Dependencies

Originally created by @ggiesen on GitHub (Jan 29, 2021). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please start a discussion instead: https://github.com/netbox-community/netbox/discussions NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.8 * NetBox version: 2.10.2 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality The current implementation of custom fields only allows for a single value. I propose that we allow to add multiple instances of a custom field much the same tags can be applied to almost anything <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case To add static routes on a device, I currently use a custom field attached to an interface IP using the following format: \<prefix\>/\<prefixlen\> via gateway[,\<prefix\>/\<prefixlen\> via gateway] Example: `192.0.2.0/24 via 203.0.113.1,198.51.100.0/24 via 203.0.113.1` This is currently cumbersome for a few reasons: 1) The field length is limited 2) It can be hard to create, read, and edit for large numbers of values 3) It's hard to validate Instead, it would be cleaner to be able to add multiple instances of a custom field such that each value could be added, edited, removed, and validated individually. ie. 1) `192.0.2.0/24 via 203.0.113.1` 2) `198.51.100.0/24 via 203.0.113.1` <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes I would imagine new tables need to be created for the new 1:M relationships. <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies
adam added the status: duplicate label 2025-12-29 18:36:54 +01:00
adam closed this issue 2025-12-29 18:36:54 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 29, 2021):

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #5451 for further discussion.

@jeremystretch commented on GitHub (Jan 29, 2021): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #5451 for further discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4516