mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-13 22:03:32 +01:00
Make slug fields optional for all models #5803
Closed
opened 2025-12-29 19:32:49 +01:00 by adam
·
37 comments
No Branch/Tag Specified
main
21050-device-oob-ip-may-become-orphaned
21102-fix-graphiql-explorer
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
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.3-r1
v1.0.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#5803
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jeremystretch on GitHub (Dec 19, 2021).
NetBox version
v3.1.1
Feature type
Change to existing functionality
Proposed functionality
For all 22 models which currently have a required slug field, make the field optional and remove the uniqueness requirement. This will make the slug field no longer required in UI forms and REST API serializers.
Use case
Slugs are no longer used as unique identifiers in NetBox URLs, and no longer serve any native function. #8036 proposed removing slug fields entirely, however some users have expressed opposition to this idea. As an alternative, making slugs optional will preserve their utility for those users while alleviating the undue burden they place on users who do not.
Users who wish to still enforce slugs as required fields can employ simple custom validation rules to do so.
Database changes
A migration will be introduced within each app altering all
models.SlugFieldinstances to setblank=True.External dependencies
No response
@candlerb commented on GitHub (Dec 19, 2021):
I have no objection, except I think they should remain unique (per model).
@jeremystretch commented on GitHub (Dec 19, 2021):
@candlerb please elaborate on why.
@candlerb commented on GitHub (Dec 19, 2021):
If a slug has any usefulness, then it's because it's a unique identifier. If I know object X has slug Y, then I can search for
/foo/?slug=Yand be sure I get exactly zero or one.The field already has a unique constraint, so why remove it? People who don't want to use slugs can set them to null.
@kkthxbye-code commented on GitHub (Dec 19, 2021):
For automation we have the id, which is a unique identifier. So the usecase is a human searchable unique key with constraints regarding charset? And name with custom constraints is not enough?
@sol1-matt commented on GitHub (Dec 20, 2021):
@kkthxbye-code
ID's are good for machines but not as good for people, often automation is building something that humans will look at.
Example 1
If the automation you are using does something like use templates to create relationships then you end up with a bunch of templates named
123which are terrible at describing the template itself. The current slug means your unique link between objects is also human readable eg:the-earth.Example 2
In the filter example from @candlerb a human will likely know a slug name but they won't know the id. So using a slug in a filter is straight forward where as using the id will require something to lookup the id.
I know I've run into this with id's in Netbox and why I've built a lot of automation around slugs, it simplifies things greatly with the same safety.
@candlerb
I don't disagree with the uniqueness constraint but I'd encourage you to look at custom validation as the method of enforcing that, I had a play around with it and it was fairly straight forward and better than built in validation.
@jeremystretch commented on GitHub (Dec 20, 2021):
Slugs aren't good for people either: They were only ever intended to serve as an alternative identifier in URLs. Such a system should always be presenting a proper human-friendly value to the user, retrieved from the database being queried. This is exactly how the NetBox UI works: When you go to add a device, you see a list of proper site names, but the form submits the selected site's numeric ID.
Slugs are stored as strings. If we make them optional, empty slugs will be stored as empty strings. Retaining the unique constraint in its current form would not permit more than one empty slug per model (because
"" == ""). An alternative approach would be store empty slugs asnull(because null != null), however that's generally not recommended as it can lead to other issues. However, I think we may be able to leverage UniqueConstraint conditions here to apply the constraint only when a slug is defined.@DanSheps commented on GitHub (Dec 20, 2021):
Slugs are generally a human friendly value stored in the database. I know we used them strictly as URL components, but slugs really are suppose to be short human-usable labels for something.
Going back to the DJango docs:
Slug is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs.Can't get much more human friendly then that IMO. Using names, you add additional formatting potential (punctuation, additional characters, etc) which aren't allowed in a slug field.A slug field (in general) isn't meant to replace the name field but compliment it so that you can quickly reference it in things like the REST API, the Python API, etc. For example, lets take the
Dunder-Mifflin Inc.tenant. First, you have a space, a hyphen and a period in addition to the alphanumeric characters, however this renders todunder-mifflin-incin a slug.Lets say you don't remember the ID but you want to get all devices belonging to Dunder Mifflin. Sure, you can search by name, however the name mostly has to be exact (Sure, you could do name__startswith=
Dunder-Mifflinbut that could pull unintended data). With a slug, you only need to remember the slug rules (alphanum, hyphens) to find the devices, less chance of getting the wrong data, less chance of getting nothing at all.Moving over to the rest API, you can only query by slug or ID on related fields currently in most instances. There really isn't a way to query by name. We would either need to drop in a new filter for name or everyone would need to hit the API first for the PK of what they want. TBH, I wish we had slugs on more things but that is just me.
I like this idea. Only care about it when slug is not None or ""
@DanSheps commented on GitHub (Dec 20, 2021):
One additional comment, perhaps add a configuration option to "hide" the slug field completely. I know we have typically shied away from hiding information within NetBox but given the split of people who want to use slugs and those who don't, I think removing it from view might make those that don't want it happier as well.
@rfdrake commented on GitHub (Jan 4, 2022):
I'm only noting this so that people are aware. I don't particularly care if slugs exist or not.
The ansible modules for netbox use slugs in many ways. Some of which are probably inappropriate but would need to be refactored to keep the modules working. That also means that people using them in production would need to refactor their playbooks to account for the changes.
An example is tying a block to a site. Here is a stub of an ansible task:
In this case, the block['site'] is the slug rather than the site name.
From what I've read, the ansible module is currently looking for a maintainer. It might be difficult to coordinate this change to it's users. (https://github.com/netbox-community/ansible_modules#looking-for-new-maintainers)
@candlerb commented on GitHub (Jan 10, 2022):
@DanSheps said:
To expand that with a concrete example, this is from VirtualMachineFilterSet:
site_idfilters by the site's sequential database ID,sitefilters by the site's slug. There are a lot of filters like this. This is one reason why I think slugs should be unique per model; if you're going to identify something by a slug, you really don't want to be dealing with ambiguity at the same time.It would in principle be possible to add
site_nameas a new query filter. That's going to add a lot of different filters all over the place, for lots of other things you might filter by. You'd also have to decide whether to mix together the results from multiple sites which happen to have the same name (ugh), or to give an error if there is no unique name match, maybe (ab)using 409 for this.If getting rid of slugs completely, then the plain
sitefilter could be deprecated and eventually removed.@jeremystretch commented on GitHub (Jan 10, 2022):
But why are you identifying anything by a slug to begin with? The slug is not a value that can be assumed by the user (such as an object's proper name may be). So in order to know the slug, you must first have retrieved the object from the database at some point. And since you've already retrieved the object from the database, you know and can use its database ID. The slug is irrelevant.
@candlerb commented on GitHub (Jan 10, 2022):
For example, because I'm identifying a site from a script, and a config file points to the particular site I want to select. Sure, I could lookup the site's ID first, and put that in the config file. But then (a) it would be opaque, and (b) it would be different between two different Netbox instances, say dev and prod.
You could say the same thing about tags. Which is clearer, filtering on
tag_id=9ortag=gateway?Aside 1: tags right now are a special case. Firstly,
/extras/tags/9/doesn't show any slug, but/extras/tags/add/does prompt you for a slug. Secondly, it enforces uniqueness on both name and slug. When I filter bytag=fooI'm not actually sure if that's the slug or the name I'm using; I'd hope it's the slug.Aside 2: I have a vague memory that there was somewhere in the web UI that used the slug as part of the URL, but I can't find it now - maybe it was changed to use ID instead? (EDIT: found it, in v2.11 - "All objects now use numeric IDs in their UI view URLs instead of slugs")
@jeremystretch commented on GitHub (Jan 10, 2022):
How is that any different from using its database ID? How do you handle objects that don't have a slug?
Yes, we changed all URLs to use the database ID consistently some time ago, as we realized the slug was redundant.
@candlerb commented on GitHub (Jan 10, 2022):
e.g.
site=ldexinstead ofsite_id=7I know what site "ldex" refers to, and it's stable between Netbox instances. I don't know what site 7 is, and it cannot be aligned between Netbox instances, unless one is an exact SQL replica of the other.
I think it's the same as
tag=productionversustag_id=123. It would be possible to forbid referencing tags by anything other than their database ID; I don't think that would be an improvement.I guess the main example is IP addresses and prefixes; I'd do a lookup IP address and VRF, as I wouldn't want to hardcode
ipaddress_id=12345. I could see a use for having slugs on prefixes and ranges.@jeremystretch commented on GitHub (Jan 10, 2022):
This isn't a problem we're trying to solve for (but of course you could use the name just as you do the slug).
Much more than those two: most models in NetBox don't include a slug field. 23 models have a slug field whereas the remaining ~66 do not.
Exactly, you use values you already know: the address, or name, or whatever other attribute(s) you have to identify the object. The slug is just a redundant mechanism.
@DanSheps commented on GitHub (Jan 10, 2022):
I think the problem is, names don't have specific naming rules to enforce a specific subset of characters (alphanum, "-" and "_") that are predictable.
To give an example, there was someone working on a script (I would have to dig it up) and he was having a problem because the name had all different punctuation and capitalization so it was creating multiple objects, however if you go by slugs, they are generally lowercase and only have a - to replace any special characters or whitespace. This is where slugs shine, being predictable and well defined. I think there are more models they could be included on, but that is just me.
@sol1-matt commented on GitHub (Jan 10, 2022):
This can be solved in one direction with the use of custom filters.
You create a filter that checks the rules that the
namefield should use. The same filter can slugify the name in the same way your external application would and then check the rules the slug should match as well and reject the name if it won't match. This way if a user enters something in the name field that will be problematic for an external applications "slug" it is caught at data entry time.This won't help if you are taking external data and trying to lookup the slug in Netbox, you'd only be able to lookup on name. The custom filters here can still help some to ensure name case insensitive uniqueness so filters don't pick up multiple results.
I think it boils down to needing to put a bit of thought into Netbox if you want to automate with it.
@DanSheps commented on GitHub (Jan 10, 2022):
But then you are hamstringing your name field to follow the slug requirements which it might not need to or be desirable to do.
@sol1-matt commented on GitHub (Jan 11, 2022):
I don't think so, you can have different requirements for name and your external slug value. But at the same time those requirements may mean some names aren't allowed because of slug requirements.
eg you have a 6 char minimum on name and slug
so name
t - 123is valid but slug with only underscoret_123slug isn't valid (we ate the duplicates) so name fails, make the name longer please.The alternative is a custom field for external slug that is automatically filled out along with the name, I was wondering if this is possible by abusing the custom filters. Then you can lookup the custom field.
@DanSheps commented on GitHub (Jan 11, 2022):
Okay, but where is the slug field in this instance? Still need a slug field to have two different values. Spaces aren't valid in a slug field.
There is no automatic fill of a custom field now, so this fails the use-case for slugs as well.
@sol1-matt commented on GitHub (Jan 11, 2022):
If you are using an external application that uses Netbox as a source of truth and needs slugs then you can create the slugs on the fly at export/import time, I've done this irl and it works well.
The Custom Validators can ensure the name field is validated to a level where it knows the externally created slug will be valid, I've also done this and it is working well on an existing dataset though I've had to rename on edit a couple of times, I now have better data :)
I suspect custom validators could be abused for this purpose, I'm very interested in testing this out but won't have time this month most likely. Custom validators would be the right place to add this too as you want to ensure the automatic slug is validated too.
Slugification of Netbox names something that is important to me but may be a add on for my requirements rather than core Netbox. I'm still looking for any corner cases that can't be handled if slugs disappear in Netbox.
Edit: feel free to hit me up in netbox slack if you want to discuss what I've done, same name and avatar
@DanSheps commented on GitHub (Jan 11, 2022):
You can't use export templates on the API, so this can't be done in all instances
Again, you are then enforcing a name field to be something it isn't, you lose fidelity on the name field.
We should not have to "abuse" a feature to get something to work for this. Slugs are here, I know some people don't like them but they also probably don't use NetBox to the fullest.
@jcralbino commented on GitHub (Jan 21, 2022):
My experience with ansible is that when using a name to search this is actually reverted to the slug that expected to solve the "-" in the name to a "_" in slug.
Example here
https://github.com/netbox-community/netbox/issues/6955
So this will be for sure a breaking change that requires work on ansible modules and eventually also in several python scripts.
I believe before committing this change in a final version a migration plan out of the slug should be identified.
A proposal could be to eventually allow users, developers get statistics and insight when they are using this.
I would create a report( custom log file if you will) in the next version 3.n of some sort every time a slug is used instead of the name, that could redirect developers out of this feature easily. In the end of week this could be summarised and sent to a administrator for review.
The goal would be the on version 3.n+2 for example slugs could be removed without impacting current environments
@sleepinggenius2 commented on GitHub (Mar 2, 2022):
I just wanted to add two use cases for slugs that my company uses in production today.
First, they are used to enforce our naming conventions on things like locations and devices based on the tenant, site, and device role slugs. Moving this to a custom field and updating thousands of records is not something I would really want to do, as the existing slug mechanism meets our needs in that respect.
Second, slugs are so useful as an accessor field for imports. For example, on tenants, we can use the department cost center or a customer ID as the slug, which allows the name to be changed, but the object to still be referenced consistently. Again, I understand that could be done with custom fields now, but when it was first implemented, you could not add a unique constraint to custom fields, so going back and updating thousands of records just to implement it that way now is impractical.
I would argue that in our scenarios, the slug has a semantic meaning that people already know and can generally be entered directly, not looked up first. I can understand where not everyone has a use case for that field and can find it to be a burden to always have to set it, though the current auto generation mechanism should alleviate a lot of that. I would definitely not want to see the field removed, but I think it makes sense to add a configuration option to hide and/or make it not required. I think it could be useful to allow applying that on a per-model basis, but then that starts getting into #5777 territory.
@candlerb commented on GitHub (Mar 20, 2022):
Just noting a particular case where use of slugs is mandatory and that's in query params in the REST API, when using
foo=...rather thanfoo_id=...to limit by a related object.I think it will be highly confusing if you're allowed to set non-unique slugs on any object type; it means a query for
type=foomay act the same astype_id=8&type_id=9Furthermore, it would also be weird if the rules for setting slugs become more lax than the rules for setting names. For example, ClusterType has a unique constraint on name, but the proposal is to remove the unique constraint on slug (while leaving the unique constraint on name!)
What I would like to see is:
@seismiccollision commented on GitHub (Mar 29, 2022):
i'd just like to +1 for slugs
it was really convenient to be able to directly reach an object from a human-readable url like how sites was. i know that ship has sailed but i'm going to miss it
it's easier said than done to get every external system to query netbox to get an ID before crafting a url so i'm often stuck with a user experience of two clicks to reach the specific object a user wanted (as far as i know) instead of a link to a query result
and related to slugs in urls, i'd still rather rely on slugs over externally storing links to an object id because accidental object deletions do happen and it's just nice to know what a link is going to show you by looking at it
sorry if i don't know what i'm talking about, i'm just a netbox end user but i'm still trying to catch up from changes made in 2.10 so figure i need to be more engaged commenting on things that will make things more difficult for me when i see them
@ryanmerolle commented on GitHub (May 28, 2022):
There would likely be a bunch of implications related to this with the ansible inventory plugin and ansible modules if everything did not always have a slug.
We might be able lessen the blow if we auto-slugify object names for ansible, but it would be a decent amount of work and likely break a lot of people's Ansible integrations.
I could be overthinking this; @rodvand what are your thoughts?
@rodvand commented on GitHub (May 28, 2022):
The ansible modules would have to start using the name as an identifier. There are already some issues today when people use non auto-generated slugs and their playbooks fail. It's also not apparent to everyone that slugs are the main identifier used, so I can see moving away from slugs being a good thing. Will be some work though...
@DanSheps commented on GitHub (May 29, 2022):
Names are not guaranteed unique (neither are slugs but I can see a way to fix that with some sort of auto-generated slug).
@rodvand commented on GitHub (May 29, 2022):
That's true, the name would be used in conjunction with other attributes to ensure uniqueness. Using auto-generated unique slugs wouldn't really solve anything for the ansible modules as users are inputting the name of a device, and it's turned into a slug used in the API calls. So if a user inputs "Device 1" it's translated to device-1 and so on. If you have two Device 1 there wouldn't be a way to differentiate them purely on the slug (as the modules would both just translate them to the slug device-1).
I think we've highlighted the ansible modules use of slugs. Not a show stopper, but a revamp of the modules is needed.
@sol1-matt commented on GitHub (Jun 1, 2022):
@rodvand
I have my own ansible inventory manly because the built in one was insufficient for my needs. As a result my ansible inventory ended up using a sanitized name, or other text field which uniquely identifies the Netbox object, to generate unique groups and vars in the inventory.
I also do the same thing with a Icinga Director import module.
Both the external systems have their own naming quirks, I suspect other external systems would have their own unique naming requirements.
Before this issue I used Slug, it was good but each system using a naming convention that suits it is better.
To ensure the Netbox data is safe for the external systems I'm using Custom Validators in Netbox to perform the same sanitization and ensure all requirements are met at data entry time. This is working very nicely in practice all around.
The only real downside is I need to maintain code for each external system and in the custom validators.
This doesn't address anything relying on the slugs to get/push data to netbox. Just pulling it.
@ryanmerolle commented on GitHub (Jun 3, 2022):
Would this also break graphql filtering?
Examples using demo.netbox.dev:
Does not work so does not filter.
Works/filters:
@seismiccollision commented on GitHub (Jun 16, 2022):
this morning two months later i still think it's a better user experience to be able to link people to https://demo.netbox.dev/circuits/providers/centurylink/ where
reading the link makes sense to humans
vs https://demo.netbox.dev/circuits/providers/2/ which means nothing and would change if the object gets accidentally deleted or the two-click user experience that doesn't sacrifice readability of linking to a search https://demo.netbox.dev/circuits/providers/?name=CenturyLink
@candlerb commented on GitHub (Jun 16, 2022):
Except previously it would have been https://demo.netbox.dev/circuits/providers/level3/ so it isn't a stable identifier anyway.
Personally I would like UUIDs as IDs/slugs, so as to be able to copy and sync objects safely between Netbox instances, but I know that's not going to happen.
@seismiccollision commented on GitHub (Jun 17, 2022):
maybe it's not inherently stable but it's still nice having a unique human readable url for every object
a provider's name spreads far and wide because it is the unique identifier so long as it is stable. just went through renaming a provider and found 11 systems each with multiple references that needed changing because they aren't yet tied to netbox
@github-actions[bot] commented on GitHub (Aug 16, 2022):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
@github-actions[bot] commented on GitHub (Sep 15, 2022):
This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.