Show linked foreign key in table cells

This commit is contained in:
Simon Willison 2017-11-22 20:43:27 -08:00
commit 38dc1ef73b
No known key found for this signature in database
GPG key ID: FBB38AFE227189DB
2 changed files with 6 additions and 1 deletions

View file

@ -626,7 +626,7 @@ class TableView(BaseView):
other_table, label = expanded[(column, value)]
display_value = jinja2.Markup(
# TODO: Escape id/label/etc so no XSS here
'<a href="/{database}-{database_hash}/{table}/{id}">{label}</a>'.format(
'<a href="/{database}-{database_hash}/{table}/{id}">{label}</a> <em>{id}</em>'.format(
database=database,
database_hash=database_hash,
table=escape_sqlite_table_name(other_table),

View file

@ -18,6 +18,11 @@ td {
padding: 4px;
vertical-align: top;
}
td em {
font-style: normal;
font-size: 0.8em;
color: #aaa;
}
th {
padding-right: 1em;
}