kopia lustrzana https://github.com/simonw/datasette
Fix for incorrect hidden for fields for _columns, refs #1527
rodzic
83eb29dece
commit
06762776f7
|
@ -889,7 +889,11 @@ class TableView(RowTableShared):
|
|||
|
||||
form_hidden_args = []
|
||||
for key in request.args:
|
||||
if key.startswith("_") and key not in ("_sort", "_search", "_next"):
|
||||
if (
|
||||
key.startswith("_")
|
||||
and key not in ("_sort", "_search", "_next")
|
||||
and not key.endswith("__exact")
|
||||
):
|
||||
for value in request.args.getlist(key):
|
||||
form_hidden_args.append((key, value))
|
||||
|
||||
|
|
|
@ -326,6 +326,19 @@ def test_existing_filter_redirects(app_client):
|
|||
assert "?" not in response.headers["Location"]
|
||||
|
||||
|
||||
def test_exact_parameter_results_in_correct_hidden_fields(app_client):
|
||||
# https://github.com/simonw/datasette/issues/1527
|
||||
response = app_client.get(
|
||||
"/fixtures/facetable?_facet=_neighborhood&_neighborhood__exact=Downtown"
|
||||
)
|
||||
# In this case we should NOT have a hidden _neighborhood__exact=Downtown field
|
||||
form = Soup(response.body, "html.parser").find("form")
|
||||
hidden_inputs = {
|
||||
input["name"]: input["value"] for input in form.select("input[type=hidden]")
|
||||
}
|
||||
assert hidden_inputs == {"_facet": "_neighborhood"}
|
||||
|
||||
|
||||
def test_empty_search_parameter_gets_removed(app_client):
|
||||
path_base = "/fixtures/simple_primary_key"
|
||||
path = (
|
||||
|
|
Ładowanie…
Reference in New Issue