label_column now defined on the table-being-linked-to, fixes #234

This commit is contained in:
Simon Willison 2018-04-22 13:46:18 -07:00
commit f3f4295712
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
4 changed files with 27 additions and 9 deletions

View file

@ -525,8 +525,8 @@ class RowTableShared(BaseView):
foreign_keys = table_info['foreign_keys']['outgoing']
for fk in foreign_keys:
label_column = (
# First look for metadata.json definition:
table_metadata.get('label_column')
# First look in metadata.json definition for this foreign key table:
self.table_metadata(database, fk['other_table']).get('label_column')
# Fall back to label_column from .inspect() detection:
or tables.get(fk['other_table'], {}).get('label_column')
)