Skip to content

How to always use dataset UUID for name/URL? #8091

Answered by wardi
themowski asked this question in Q&A
Discussion options

You must be logged in to vote

This is how we set the name to be the same as the id of our datasets:

https://github.com/open-data/ckanext-canada/blob/69b04b8eaf2750b3e95239783d2768248240e10e/ckanext/canada/schemas/presets.yaml#L29-L34

form_snippet: null hides the name field on the form and if_empty_same_as(id) copies the id value over.

There are some cases where we had an old UUID that we wanted to map to a new id so we allow name to be set to a different value so that our site can accept both, but it still needs to be a UUID because of canada_validate_generate_uuid defined here:

https://github.com/open-data/ckanext-canada/blob/69b04b8eaf2750b3e95239783d2768248240e10e/ckanext/canada/validators.py#L144-L154

Looking at n…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@themowski
Comment options

Answer selected by themowski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants