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
|
|
@ -524,7 +524,12 @@ class RowTableShared(BaseView):
|
|||
if table_info and expand_foreign_keys:
|
||||
foreign_keys = table_info['foreign_keys']['outgoing']
|
||||
for fk in foreign_keys:
|
||||
label_column = tables.get(fk['other_table'], {}).get('label_column')
|
||||
label_column = (
|
||||
# First look for metadata.json definition:
|
||||
table_metadata.get('label_column')
|
||||
# Fall back to label_column from .inspect() detection:
|
||||
or tables.get(fk['other_table'], {}).get('label_column')
|
||||
)
|
||||
if not label_column:
|
||||
# No label for this FK
|
||||
fks[fk['column']] = fk['other_table']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue