Don't persist _next in hidden field, closes #1483

pull/1471/head
Simon Willison 2021-10-13 14:08:06 -07:00
rodzic 0d5cc20aef
commit b50bf5d13f
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -889,7 +889,7 @@ class TableView(RowTableShared):
form_hidden_args = []
for key in request.args:
if key.startswith("_") and key not in ("_sort", "_search"):
if key.startswith("_") and key not in ("_sort", "_search", "_next"):
for value in request.args.getlist(key):
form_hidden_args.append((key, value))

Wyświetl plik

@ -563,6 +563,16 @@ def test_facets_persist_through_filter_form(app_client):
]
def test_next_does_not_persist_in_hidden_field(app_client):
response = app_client.get("/fixtures/searchable?_size=1&_next=1")
assert response.status == 200
inputs = Soup(response.body, "html.parser").find("form").findAll("input")
hiddens = [i for i in inputs if i["type"] == "hidden"]
assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == [
("_size", "1"),
]
@pytest.mark.parametrize(
"path,expected_classes",
[