mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Persist _where= in hidden fields, closes #604
This commit is contained in:
parent
5dd4d2b2d3
commit
e2c390500e
2 changed files with 9 additions and 0 deletions
|
|
@ -721,6 +721,9 @@ class TableView(RowTableShared):
|
||||||
for arg in ("_fts_table", "_fts_pk"):
|
for arg in ("_fts_table", "_fts_pk"):
|
||||||
if arg in special_args:
|
if arg in special_args:
|
||||||
form_hidden_args.append((arg, special_args[arg]))
|
form_hidden_args.append((arg, special_args[arg]))
|
||||||
|
if request.args["_where"]:
|
||||||
|
for where_text in request.args["_where"]:
|
||||||
|
form_hidden_args.append(("_where", where_text))
|
||||||
return {
|
return {
|
||||||
"supports_search": bool(fts_table),
|
"supports_search": bool(fts_table),
|
||||||
"search": search or "",
|
"search": search or "",
|
||||||
|
|
|
||||||
|
|
@ -955,6 +955,12 @@ def test_extra_where_clauses(app_client):
|
||||||
"/fixtures/facetable?_where=city_id%3D1",
|
"/fixtures/facetable?_where=city_id%3D1",
|
||||||
"/fixtures/facetable?_where=neighborhood%3D%27Dogpatch%27",
|
"/fixtures/facetable?_where=neighborhood%3D%27Dogpatch%27",
|
||||||
] == hrefs
|
] == hrefs
|
||||||
|
# These should also be persisted as hidden fields
|
||||||
|
inputs = soup.find("form").findAll("input")
|
||||||
|
hiddens = [i for i in inputs if i["type"] == "hidden"]
|
||||||
|
assert [("_where", "neighborhood='Dogpatch'"), ("_where", "city_id=1")] == [
|
||||||
|
(hidden["name"], hidden["value"]) for hidden in hiddens
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_binary_data_display(app_client):
|
def test_binary_data_display(app_client):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue