-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Natural Slug Property #4346
Comments
Just to provide some color and concrete use cases, all of which could be handled in other manners, but trying to provide a reasonable user experience:
|
After a few conversations, we are going to change some of the behavior of "composite keys" to to meet these usability concerns. We will retain all of the underlying natural key functionality, however, the "composite key" forward and reverse functionality, based on a single string value, will be changed to the long standing "slugify" charset. The major reason for this is that the well intention implementation of the current composite key strings has created something that is not actually usable and thus users and developers are looking for something slightly different, hence this issue. For this issue, we will:
We may:
In the future we will:
|
Hey team! Please add your planning poker estimate with Zenhub @glennmatthews @gsnider2195 @HanlinMiao @jathanism @timizuoebideri1 |
This may need some clarification - currently composite keys are used in CSV export/import as the default way of referencing related models. Are we proposing that CSV export will 1) change to export PKs for related models 2) change to explicit natural-key fields for related models or 3) remain as-is with some sort of approach to resolving non-unique composite-key-slugs? |
|
We should not call this |
Could we keep composite_key the way it is, a URL safe representation of the natural key, and then add a new field for the slugified natural key? |
What's your use case for /cc: @lampwins |
In NautobotChatOps, we have the user filter down to Devices, Racks, Circuits, etc. Currently, when the user chooses a device, the command used the PK as that is the lookup in 1.x. It would be great to be able to use the natural key instead. But it could be challenging switching to the natural key due to the way that the command input works in ChatOps. That said, looking at more examples of composite_key that has special characters would make the command input challenging anyways. I would love to use the new property proposed, but it absolutely needs to be able to be used as a lookup. |
This said, I am leaning towards changing my position and instead use the natural key(s), but with a function that assists in taking the natural key output and joining it in a single string. Then when I need to us it as a lookup, splitting it back out into the natural key(s). |
That won't be possible or at the very least error-prone as the slug can't be guaranteed to be unique and it's inherently lossy: |
TODO
From @lampwins comment below:
slugify_dashes_to_underscores
function).natural_slug
and should be accessible via the REST and GraphQL APIs314b709c-fa1e-46af-8c49-dfedd1f4081c
append_314b
) to aid in minimizing collisionsAs ...
P.D. - Plugin Developer
I want ...
The ability to have a standard way to that "slugify" is provided. The request is to have a property that is called slug, based on name, and
uniqueness is enforcedbased on this as well.So that ...
I know this is done when...
There is a slug property on any model that has the "name" attribute on it.
Optional - Feature groups this request pertains to.
Database Changes
Yes, add properties
External Dependencies
No response
The text was updated successfully, but these errors were encountered: