Open inglesp opened 2 years ago
@inglesp Another user encountered this again today, so I've added it to the data teams awaiting triage list
Although, in this case a codelist was created with the name "Coeliac Disease SNOMED" but the slug "coeliac-disease" (it looks like it was imported via the api, hence the different slug). The user wants to change the slug to match the name, but can't, because that would create a new handle with the same name. Making them change the name when they change the slug would mean they're forced to rename the codelist to a name they don't necessarily want. This particular case is probably fairly rare though, usually a codelist would get the slugified version of the name automatically.
If you try to change a codelist's slug without changing the name via the "update metadata" page, you're told "Duplicate slug".
This is confusing and wrong.
The cause is that changing the slug creates a new handle (which allows us to redirect from the old slug to the new) -- but there's a database constraint that stops two handles belonging to the same owner from having the same name. We catch the
IntegrityError
, but misinterpret it.So if you change a slug, you should be made to change the name too.