This new name_slug field is a URL-friendly version of the existing
name field, which will allow us to have a friendly natural key without
having to worry about conflicts with things such as slashes in the URL.
The slugification is done by our own function rather than Django's
built-in slugify(). The built-in is too agressive and would cause
conflicts with certain interface names. For example, since it simply
drops slashes, the two following interfaces would slugify out to be the
same thing, causing a uniqueness conflict:
Ethernet1/2/3
Ethernet12/3
Our slugify function simply replaces / with _, which is the bare
minimum to make these names URL-friendly.
The purpose of this is the same as dropbox/nsot#258, where this fixes a
bug that keeps clients from working with circuits by their name if the
name contains a slash.
This new
name_slug
field is a URL-friendly version of the existingname
field, which will allow us to have a friendly natural key without having to worry about conflicts with things such as slashes in the URL.The slugification is done by our own function rather than Django's built-in
slugify()
. The built-in is too agressive and would cause conflicts with certain interface names. For example, since it simply drops slashes, the two following interfaces would slugify out to be the same thing, causing a uniqueness conflict:Ethernet1/2/3
Ethernet12/3
Our slugify function simply replaces
/
with_
, which is the bare minimum to make these names URL-friendly.The purpose of this is the same as dropbox/nsot#258, where this fixes a bug that keeps clients from working with circuits by their name if the name contains a slash.