Hacky way of adding to human description

m2m
Simon Willison 2018-07-30 21:00:51 -07:00
rodzic 04c7fd6207
commit af4ce463e7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -305,6 +305,7 @@ class TableView(RowTableShared):
where_clauses, params = filters.build_where_clauses()
# Hacky thing for ?_m2m_ad_targets__target_id=9a8c6
extra_human_descriptions = []
for m2m_key in request.args:
if m2m_key.startswith("_m2m_"):
rest = m2m_key.split("_m2m_", 1)[1]
@ -328,6 +329,9 @@ class TableView(RowTableShared):
value=value,
)
)
extra_human_descriptions.append(
'{} contains "{}"'.format(m2m_table, value)
)
# _search support:
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]
)
if extra_human_descriptions:
human_description_en += " and ".join(extra_human_descriptions)
async def extra_template():
display_columns, display_rows = await self.display_columns_and_rows(
name,