{% extends "base.html" %} {% block title %}{{ database }}: {{ table }}: {% if count_truncated %}{{ "{:,}".format(count - 1) }}+ rows{% elif count or count == 0 %}{{ "{:,}".format(count) }} row{% if count == 1 %}{% else %}s{% endif %}{% endif %}{% if human_description_en %} {{ human_description_en }}{% endif %}{% endblock %} {% block extra_head %} {{- super() -}} {%- if display_columns %} {#- The columns remembered for this table in this browser, see table.js. A URL that says which columns to show is always obeyed. One that does not shows the remembered ones, by going to the URL that lists them, before the page is drawn. Columns that are no longer there are forgotten, and columns added to the table since they were remembered are shown, at the end: the ones that were not there to be chosen or hidden. #} {%- endif %} {#- The column chooser's list is reordered by dragging, as are the columns of the alter table dialog #} {#- The row edit and insert dialogs search the other table to add many-to-many links #} {#- The filter form searches the other table for many-to-many filters #} {#- The alter table dialog's Relationships section searches the database's tables #} {% if table_alter_ui or table_page_data.foreignKeys or ((table_insert_ui or row_mutation_ui) and (table_columns or [])|selectattr("kind", "equalto", "m2m")|map(attribute="header")|selectattr("can_add")|list) or ((m2m_filters or {}).relations or [])|selectattr("autocomplete_url")|list %} {% endif %} {% if table_insert_ui or table_alter_ui or row_mutation_ui %} {% include "_edit_tools_loader.html" %} {% endif %} {% if table_page_data.executeSql %} {% include "_column_stats_loader.html" %} {% endif %} {% endblock %} {% block body_class %}table db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %} {% block crumbs %} {{ crumbs.nav(request=request, database=database, table=table) }} {% endblock %} {% block recent_item %}{% with recent_type=("view" if is_view else "table"), recent_name=table, recent_title=metadata.get("title"), recent_url=urls.table(database, table) %}{% include "_recent_item.html" %}{% endwith %}{% endblock %} {% block content %} {% set action_links, action_title = actions(), "View actions" if is_view else "Table actions" %} {% include "_action_menu.html" %} {{ top_table() }} {% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %} {% if metadata.get("columns") %}
{% for column_name, column_description in metadata.columns.items() %}
{{ column_name }}
{{ column_description }}
{% endfor %}
{% endif %} {% macro pagination_links() %} {% if page_position %} Back to first page {% endif %} {% if next_url %} Next page {% endif %} {% endmacro %} {# The heading always carries the total row count; the position strip above the table repeats it alongside the page position #} {% set paginated = page_position or next_url %} {% set count_in_strip = paginated and count is not none and not count_truncated %} {% if count or count == 0 or human_description_en %}

{% if count_truncated %}{{ "{:,}".format(count - 1) }}+ rows {% elif count or count == 0 %}{{ "{:,}".format(count) }} row{% if count == 1 %}{% else %}s{% endif %}{% endif %} {% if human_description_en %}{{ human_description_en }}{% endif %}

{% endif %}
{% if supports_search %}
{% endif %} {% set m2m_filter_data = m2m_filters or {"relations": [], "rows": [], "lookups": []} %} {% set column_selections = filters.selections()|list %} {#- The column select lists the table's columns, then its many-to-many relationships as "_m2m.NAME" options, see m2m_filter_ui() #} {% macro filter_column_options(selected) %} {% for c in filter_columns %} {{ c }} {% endfor %} {% if m2m_filter_data.relations %} {% for relation in m2m_filter_data.relations %} {% endfor %} {% endif %} {% endmacro %} {% macro column_lookup_options(selected) %} {% for key, display, no_argument in filters.lookups() %} {% endfor %} {% endmacro %} {% macro m2m_lookup_options(selected) %} {% for key, display in m2m_filter_data.lookups %} {% endfor %} {% endmacro %} {% for column, lookup, value in column_selections %}
{% endfor %} {#- One row for each ?_m2m.NAME[__lookup]=value. Without JavaScript the value input holds the other table's key; table.js turns it into a search by label, see initM2MFilterRows() #} {% for m2m_row in m2m_filter_data.rows %} {% set number = column_selections|length + loop.index %}
{% endfor %}
{% if m2m_filter_data.relations %} {#- Operator options for table.js to switch between when the column select changes between a column and a related table #} {% endif %}
{% if is_sortable %}
{% endif %} {% for key, value in form_hidden_args %} {% endfor %} {% if clear_filters_url %} Clear filters {% endif %}
{% if extra_wheres_for_ui %}

{{ extra_wheres_for_ui|length }} extra where clause{% if extra_wheres_for_ui|length != 1 %}s{% endif %}

    {% for extra_where in extra_wheres_for_ui %}
  • {{ extra_where.text }} [remove]
  • {% endfor %}
{% endif %}
{% if query.sql and allow_execute_sql %} View and edit SQL {% endif %} {% include "_export_button.html" %} {% if all_columns %} {#- The table's own columns and its relationship columns, apart from primary keys: how many are shown, and whether that is the default. table.js keeps this up to date when columns change in place, and adds whether a custom set is the one saved in this browser #} {% set relationship_total = ((relationship_column_choices or {}).get("choices") or [])|length %} {% set columns_total = (all_columns|reject("in", primary_keys)|list|length) + relationship_total %} {% set shown_ns = namespace(count=0) %} {% for item in table_columns or [] %} {% if item.kind != "col" or not (item.header.is_pk or item.header.is_special_link_column) %}{% set shown_ns.count = shown_ns.count + 1 %}{% endif %} {% endfor %} {% set columns_custom = "_col" in request.args or "_nocol" in request.args %} {% endif %}
{% set export_meta = table %} {% set export_scope = "Filtered rows" if filter_description_en else "All rows" %} {% set export_scope_description = [filter_description_en, sort_description_en]|select|join(", ") or ("in this view" if is_view else "in this table") %} {% set export_rows = { "page": display_rows|length, "more": true if next_url else false, "later": true if request.args.get("_next") else false, "max": settings.max_returned_rows, "total": count if (count is not none and not count_truncated) else none, "count_url": urls.table(database, table) ~ "/-/count", } %} {% include "_export_dialog.html" %} {% if suggested_facets %} {% include "_suggested_facets.html" %} {% endif %} {% if facets_timed_out %}

These facets timed out: {{ ", ".join(facets_timed_out) }}

{% endif %} {% if facet_results %} {% include "_facet_results.html" %} {% endif %} {% if all_columns %} {% endif %} {% if set_column_type_ui %} {% endif %} {% if set_label_column_ui %} {% endif %} {% if table_insert_ui %}
{% endif %} {% if paginated %} {% endif %} {% include custom_table_templates %} {# A second set of buttons below the table is only worth it on a longer page #} {% if paginated and display_rows|length >= 5 %} {% endif %} {% if table_definition %}
Table schema
{{ table_definition }}
{% endif %} {% if view_definition %}
View definition
{{ view_definition }}
{% endif %} {% if allow_execute_sql and query.sql %} {% endif %} {% endblock %}