mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Hacky way of adding to human description
This commit is contained in:
parent
04c7fd6207
commit
af4ce463e7
1 changed files with 7 additions and 0 deletions
|
|
@ -305,6 +305,7 @@ class TableView(RowTableShared):
|
||||||
where_clauses, params = filters.build_where_clauses()
|
where_clauses, params = filters.build_where_clauses()
|
||||||
|
|
||||||
# Hacky thing for ?_m2m_ad_targets__target_id=9a8c6
|
# Hacky thing for ?_m2m_ad_targets__target_id=9a8c6
|
||||||
|
extra_human_descriptions = []
|
||||||
for m2m_key in request.args:
|
for m2m_key in request.args:
|
||||||
if m2m_key.startswith("_m2m_"):
|
if m2m_key.startswith("_m2m_"):
|
||||||
rest = m2m_key.split("_m2m_", 1)[1]
|
rest = m2m_key.split("_m2m_", 1)[1]
|
||||||
|
|
@ -328,6 +329,9 @@ class TableView(RowTableShared):
|
||||||
value=value,
|
value=value,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
extra_human_descriptions.append(
|
||||||
|
'{} contains "{}"'.format(m2m_table, value)
|
||||||
|
)
|
||||||
|
|
||||||
# _search support:
|
# _search support:
|
||||||
fts_table = info[name]["tables"].get(table, {}).get("fts_table")
|
fts_table = info[name]["tables"].get(table, {}).get("fts_table")
|
||||||
|
|
@ -744,6 +748,9 @@ class TableView(RowTableShared):
|
||||||
[b for b in [human_description_en, sorted_by] if b]
|
[b for b in [human_description_en, sorted_by] if b]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if extra_human_descriptions:
|
||||||
|
human_description_en += " and ".join(extra_human_descriptions)
|
||||||
|
|
||||||
async def extra_template():
|
async def extra_template():
|
||||||
display_columns, display_rows = await self.display_columns_and_rows(
|
display_columns, display_rows = await self.display_columns_and_rows(
|
||||||
name,
|
name,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue