{"html_url": "https://github.com/simonw/datasette/issues/1527#issuecomment-982318745", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1527", "id": 982318745, "node_id": "IC_kwDOBm6k_c46jP6Z", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-30T06:11:21Z", "updated_at": "2021-11-30T06:11:21Z", "author_association": "OWNER", "body": "Manually tested this too, looks like that fixed it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1059555791, "label": "Columns starting with an underscore behave poorly in filters"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1527#issuecomment-982235541", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1527", "id": 982235541, "node_id": "IC_kwDOBm6k_c46i7mV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-30T02:57:34Z", "updated_at": "2021-11-30T02:58:44Z", "author_association": "OWNER", "body": "I started fiddling with a test for this which extracts the `` fields, but I probably won't use it:\r\n```python\r\ndef test_exact_parameter_results_in_correct_hidden_fields(app_client):\r\n # https://github.com/simonw/datasette/issues/1527\r\n response = app_client.get(\r\n \"/fixtures/facetable?_facet=_neighborhood&_neighborhood__exact=Downtown\"\r\n )\r\n # In this case we should NOT have a hidden _neighborhood__exact=Downtown field\r\n form = Soup(response.body, \"html.parser\").find(\"form\")\r\n selects = [\r\n {\r\n \"name\": select[\"name\"],\r\n \"value\": select.select(\"option[selected]\")[0].text\r\n if select.select(\"option[selected]\")\r\n else \"\",\r\n }\r\n for select in form.findAll(\"select\")\r\n ]\r\n inputs = [input.attrs for input in form.findAll(\"input\")]\r\n # Turn those both into a {name: (value, type)} array\r\n form_inputs = {}\r\n form_inputs.update(\r\n {select[\"name\"]: (select[\"value\"], \"select\") for select in selects}\r\n )\r\n form_inputs.update(\r\n {\r\n input[\"name\"]: (input.get(\"value\"), input[\"type\"])\r\n for input in inputs\r\n if input.get(\"name\")\r\n }\r\n )\r\n assert form_inputs == {\r\n \"_filter_column_1\": (\"_neighborhood\", \"select\"),\r\n \"_filter_op_1\": (\"=\", \"select\"),\r\n \"_filter_value_1\": (\"Downtown\", \"text\"),\r\n \"_filter_column\": (\"\", \"select\"),\r\n \"_filter_op\": (\"\", \"select\"),\r\n \"_filter_value\": (None, \"text\"),\r\n \"_sort\": (\"Sort by pk\", \"select\"),\r\n \"_sort_by_desc\": (None, \"checkbox\"),\r\n \"_facet\": (\"_neighborhood\", \"hidden\"),\r\n \"_neighborhood__exact\": (\"Downtown\", \"hidden\"),\r\n }\r\n```\r\nThe problem is that last hidden field, `_neighborhood__exact=Downtown` - which should not be there.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1059555791, "label": "Columns starting with an underscore behave poorly in filters"}, "performed_via_github_app": null}