Skip to content
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

On database page, have the database name without the -HASH suffix #9

Closed
fgregg opened this issue Mar 19, 2022 · 2 comments
Closed

On database page, have the database name without the -HASH suffix #9

fgregg opened this issue Mar 19, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@fgregg
Copy link

fgregg commented Mar 19, 2022

On database tables, it would good to have the database name not have a -HASH prefix.

Screenshot 2022-03-19 at 09-49-52 f7-8035c93

@fgregg
Copy link
Author

fgregg commented Mar 19, 2022

the best design for how to accommodate this is not obvious.

it seems like one wouldn't want to handle this is an a custom template for this plugin

the alternative would be for all database objects to have an attribute like "display_name" and have that be used in upstream templates. but, that might be adding to much cruft if the only use case is this one plugin.

@simonw
Copy link
Owner

simonw commented Mar 19, 2022

That title in the template looks like this:

https://github.com/simonw/datasette/blob/764738dfcb16cd98b0987d443f59d5baa9d3c332/datasette/templates/database.html#L23

    <h1>{{ metadata.title or database }}{% if private %} 🔒{% endif %}</h1>

So one option would be for this plugin to use the get_metadata hook at https://docs.datasette.io/en/stable/plugin_hooks.html#get-metadata-datasette-key-database-table to customize that value - but only if it's not already customized by the metadata.json for the instance.

Worth investigating as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants