{"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709633823", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709633823, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMzgyMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:01:13Z", "updated_at": "2020-10-15T23:01:13Z", "author_association": "OWNER", "body": "Tracking ticket: #1023", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709634261", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709634261, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNDI2MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:02:43Z", "updated_at": "2020-10-15T23:02:43Z", "author_association": "OWNER", "body": "Here's the current implementation of `database_url` - on the `BaseView` class, but only because it needs access to a `datasette` instance (to read `base_url`):\r\nhttps://github.com/simonw/datasette/blob/8f97b9b58e77f82fef1f10e9c9f6754b993544b6/datasette/views/base.py#L102-L108", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709635021", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709635021, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNTAyMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:05:11Z", "updated_at": "2020-10-15T23:05:11Z", "author_association": "OWNER", "body": "I think this should be a family of functions:\r\n\r\n- `instance_url()` - the root URL of the instance (usually `/` unless `base_url` is set)\r\n- `database_url(database_name)` - already got this\r\n- `table_url(database_name, table_name)`\r\n- `row_url(database_name, table_name, row)` - not sure about this one. The idea would be for `row` to be correctly turned into a URL by introspecting the primary keys for that table, then pulling those values out of the SQLite `row` object. Might not be necessary though.\r\n\r\nI also need a way for plugins to link to e.g. `/-/configure-fts` - or even `/-/configure-fts/database-name/table-name`. What should that look like?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709635276", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709635276, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNTI3Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:05:54Z", "updated_at": "2020-10-15T23:05:54Z", "author_association": "OWNER", "body": "Could have `instance_url()` take an optional path argument which is then turned into the correct path.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null}