Auto create slug for custom fields #6784

Closed
opened 2025-12-29 19:45:22 +01:00 by adam · 1 comment
Owner

Originally created by @ghost on GitHub (Aug 8, 2022).

NetBox version

3.2.7

Feature type

Change to existing functionality

Proposed functionality

When creating other objects within netbox (ex: circuit type) you first create the 'name' then if you hit tab the 'slug' field will auto populate for you. If your name has multiple words with spaces, the slug will automatically add hyphens where spaces exist.

However, when you create custom fields the process is completely different.
The 'name' of the custom field is actually what every other area of netbox would refer to as the 'slug'. In addition, hyphens are not allowed in this field for some reason, but they are in every other slug within netbox.

Then you type your 'label' which in every other area of netbox is actually the 'name'.

Please change the custom field creation process to match all other area of netbox.

  1. Change field 'name' to 'slug'
  2. Change field 'label' to 'name'
  3. Allow hyphens in the 'slug'
  4. When typing the name of the custom field and you hit tab, have the 'slug' auto create like it does in other areas of netbox

Use case

Matching this field creation process with the rest of netbox to make things more consistent and less confusing.

Database changes

I believe the only database changes needed would be changing the field names.

External dependencies

No response

Originally created by @ghost on GitHub (Aug 8, 2022). ### NetBox version 3.2.7 ### Feature type Change to existing functionality ### Proposed functionality When creating other objects within netbox (ex: circuit type) you first create the 'name' then if you hit tab the 'slug' field will auto populate for you. If your name has multiple words with spaces, the slug will automatically add hyphens where spaces exist. However, when you create custom fields the process is completely different. The 'name' of the custom field is actually what every other area of netbox would refer to as the 'slug'. In addition, hyphens are not allowed in this field for some reason, but they are in every other slug within netbox. Then you type your 'label' which in every other area of netbox is actually the 'name'. Please change the custom field creation process to match all other area of netbox. 1) Change field 'name' to 'slug' 2) Change field 'label' to 'name' 3) Allow hyphens in the 'slug' 4) When typing the name of the custom field and you hit tab, have the 'slug' auto create like it does in other areas of netbox ### Use case Matching this field creation process with the rest of netbox to make things more consistent and less confusing. ### Database changes I believe the only database changes needed would be changing the field names. ### External dependencies _No response_
adam added the type: feature label 2025-12-29 19:45:22 +01:00
adam closed this issue 2025-12-29 19:45:22 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 10, 2022):

Custom field names are not analogous to slugs. They are field names, wheres slugs are alternative representations of field values. Names are required; labels are optional. Further, custom field names are not permitted to contain hyphens because allowing them would preclude referencing fields as object attributes (e.g. object.cf.foo in a template). And we're definitely not going to rename the CustomField attributes, as that would be a large breaking change delivering no substantial value.

@jeremystretch commented on GitHub (Aug 10, 2022): Custom field names are not analogous to slugs. They are field _names_, wheres slugs are alternative representations of field _values_. Names are required; labels are optional. Further, custom field names are not permitted to contain hyphens because allowing them would preclude referencing fields as object attributes (e.g. `object.cf.foo` in a template). And we're definitely not going to rename the CustomField attributes, as that would be a large breaking change delivering no substantial value.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6784