Don't truncate list of columns on /db page, closes #1364

pull/1370/head
Simon Willison 2021-06-06 15:07:45 -07:00
rodzic 030deb4b25
commit 03ec71193b
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -71,7 +71,7 @@
{% if show_hidden or not table.hidden %}
<div class="db-table">
<h2><a href="{{ urls.table(database, table.name) }}">{{ table.name }}</a>{% if table.private %} 🔒{% endif %}{% if table.hidden %}<em> (hidden)</em>{% endif %}</h2>
<p><em>{% for column in table.columns[:9] %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}{% if table.columns|length > 9 %}...{% endif %}</em></p>
<p><em>{% for column in table.columns %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}</em></p>
<p>{% if table.count is none %}Many rows{% else %}{{ "{:,}".format(table.count) }} row{% if table.count == 1 %}{% else %}s{% endif %}{% endif %}</p>
</div>
{% endif %}

Wyświetl plik

@ -101,6 +101,11 @@ def test_database_page_redirects_with_url_hash(app_client_with_hash):
def test_database_page(app_client):
response = app_client.get("/fixtures")
assert (
b"<p><em>pk, foreign_key_with_label, foreign_key_with_blank_label, "
b"foreign_key_with_no_label, foreign_key_compound_pk1, "
b"foreign_key_compound_pk2</em></p>"
) in response.body
soup = Soup(response.body, "html.parser")
queries_ul = soup.find("h2", text="Queries").find_next_sibling("ul")
assert queries_ul is not None