mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
label_column option in metadata.json - closes #234
This commit is contained in:
parent
ea0a761303
commit
f27cabbaf3
5 changed files with 73 additions and 3 deletions
|
|
@ -81,7 +81,7 @@ Column units are configured in the metadata like so::
|
|||
Units are interpreted using Pint_, and you can see the full list of available units in
|
||||
Pint's `unit registry`_. You can also add `custom units`_ to the metadata, which will be
|
||||
registered with Pint::
|
||||
|
||||
|
||||
{
|
||||
"custom_units": [
|
||||
"decibel = [] = dB"
|
||||
|
|
@ -119,6 +119,29 @@ This will restrict sorting of ``example_table`` to just the ``height`` and
|
|||
|
||||
You can also disable sorting entirely by setting ``"sortable_columns": []``
|
||||
|
||||
Specifying the label column for a table
|
||||
---------------------------------------
|
||||
|
||||
Datasette's HTML interface attempts to display foreign key references as
|
||||
labelled hyperlinks. By default, it looks for referenced tables that only have
|
||||
two columns: a primary key column and one other. It assumes that the second
|
||||
column should be used as the link label.
|
||||
|
||||
If your table has more than two columns you can specify which column should be
|
||||
used for the link label with the ``label_column`` property::
|
||||
|
||||
{
|
||||
"databases": {
|
||||
"database1": {
|
||||
"tables": {
|
||||
"example_table": {
|
||||
"label_column": "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generating a metadata skeleton
|
||||
------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue