Ensure query columns are included too, ref #1503

This commit is contained in:
Simon Willison 2021-11-13 21:08:33 -08:00
commit 1c13e1af06
2 changed files with 11 additions and 2 deletions

View file

@ -915,6 +915,14 @@ class TableView(RowTableShared):
links.extend(extra_links)
return links
# filter_columns combine the columns we know are available
# in the table with any additional columns (such as rowid)
# which are available in the query
filter_columns = list(columns) + [
table_column
for table_column in table_columns
if table_column not in columns
]
return {
"table_actions": table_actions,
"supports_search": bool(fts_table),
@ -922,7 +930,7 @@ class TableView(RowTableShared):
"use_rowid": use_rowid,
"filters": filters,
"display_columns": display_columns,
"filter_columns": table_columns,
"filter_columns": filter_columns,
"display_rows": display_rows,
"facets_timed_out": facets_timed_out,
"sorted_facet_results": sorted(

View file

@ -936,10 +936,11 @@ def test_table_html_filter_form_still_shows_nocol_columns(app_client):
"pk1",
"pk2",
"content",
"sortable",
"sortable_with_nulls",
"sortable_with_nulls_2",
"text",
# Moved to the end because it is no longer returned by the query:
"sortable",
]