Fix broken CSV/JSON export on query page, refs #1010

pull/1017/head
Simon Willison 2020-10-09 17:39:45 -07:00
rodzic c13d184704
commit 9f6dd985bc
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -58,7 +58,7 @@
</form>
{% if display_rows %}
<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ base_url }}{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}, <a href="{{ base_url }}{{ url_csv }}">CSV</a></p>
<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}, <a href="{{ url_csv }}">CSV</a></p>
<table class="rows-and-columns">
<thead>
<tr>

Wyświetl plik

@ -672,6 +672,13 @@ def test_row_json_export_link(app_client):
assert '<a href="/fixtures/simple_primary_key/1.json">json</a>' in response.text
def test_query_json_csv_export_links(app_client):
response = app_client.get("/fixtures?sql=select+1")
assert response.status == 200
assert '<a href="/fixtures.json?sql=select+1">json</a>' in response.text
assert '<a href="/fixtures.csv?sql=select+1&amp;_size=max">CSV</a>' in response.text
def test_csv_json_export_links_include_labels_if_foreign_keys(app_client):
response = app_client.get("/fixtures/facetable")
assert response.status == 200