CSV import should accept the "slug" value for choice fields #3987

Closed
opened 2025-12-29 18:32:28 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 14, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.8.9

Proposed Functionality

For fields which specify one of several pre-defined choices, users should be able to specify the "slug" value rather than the proper string. For example, here are the available slug values and corresponding names for a rack's type:

Slug Name
2-post-frame 2-post frame
4-post-frame 4-post frame
4-post-cabinet 4-post cabinet
wall-frame Wall-mounted frame
wall-cabinet Wall-mounted cabinet

It may make sense to use the slug value consistently for both import and export operations, though I'll leave that open for discussion.

Use Case

NetBox v2.7 replaced the old integer-based choice field IDs with human-friendly slugs. These are more convenient to handle when manipulating data, as extra attention is not needed to ensure correct capitalization, spacing, or punctuation. For example, it is quicker and simpler to write wall-frame than Wall-mounted frame, and the later provides no further information than the former within the context of data entry.

Database Changes

None

External Dependencies

None

Originally created by @jeremystretch on GitHub (Aug 14, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.8.9 ### Proposed Functionality For fields which specify one of several pre-defined choices, users should be able to specify the "slug" value rather than the proper string. For example, here are the available slug values and corresponding names for a rack's type: | Slug | Name | |------|------| | `2-post-frame` | 2-post frame | | `4-post-frame` | 4-post frame | | `4-post-cabinet` | 4-post cabinet | | `wall-frame` | Wall-mounted frame | | `wall-cabinet` | Wall-mounted cabinet | It may make sense to use the slug value consistently for both import and export operations, though I'll leave that open for discussion. ### Use Case NetBox v2.7 replaced the old integer-based choice field IDs with human-friendly slugs. These are more convenient to handle when manipulating data, as extra attention is not needed to ensure correct capitalization, spacing, or punctuation. For example, it is quicker and simpler to write `wall-frame` than `Wall-mounted frame`, and the later provides no further information than the former within the context of data entry. ### Database Changes None ### External Dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 18:32:28 +01:00
adam closed this issue 2025-12-29 18:32:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3987