2022-04-23 20:03:09 +02:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block content %}
|
2022-06-02 18:46:24 +02:00
|
|
|
<a href="create" role="button">+</a>
|
|
|
|
<table role="grid">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2022-06-06 15:25:37 +02:00
|
|
|
<th>{{ view_model.primary_key }}</th>
|
2022-06-02 18:46:24 +02:00
|
|
|
{% for model_field in view_model.fields -%}
|
2022-07-21 19:01:05 +02:00
|
|
|
<th>{{ model_field.field_name }}</th>
|
2022-06-02 18:46:24 +02:00
|
|
|
{%- endfor %}
|
|
|
|
<th>
|
|
|
|
<!-- Edit Action -->
|
|
|
|
<!-- Delete Action -->
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2022-06-04 16:34:16 +02:00
|
|
|
<tbody hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML">
|
2022-06-02 18:46:24 +02:00
|
|
|
{% for entity in entities -%}
|
|
|
|
<tr>
|
2022-06-06 15:25:37 +02:00
|
|
|
<td>{{ entity.primary_key }}</td>
|
2022-06-02 18:46:24 +02:00
|
|
|
{% for model_field in view_model.fields -%}
|
2022-07-21 19:01:05 +02:00
|
|
|
<td>{{ entity.values | get(key=model_field.field_name) }}</td>
|
2022-06-02 18:46:24 +02:00
|
|
|
{%- endfor %}
|
|
|
|
<td>
|
2022-06-06 15:25:37 +02:00
|
|
|
<a href="edit/{{ entity.primary_key }}">✎</a>
|
2022-07-26 17:47:18 +02:00
|
|
|
<a href="#" hx-post="delete/{{ entity.primary_key }}">🗑</a>
|
2022-06-02 18:46:24 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2022-04-27 18:22:47 +02:00
|
|
|
{%- endfor %}
|
2022-06-02 18:46:24 +02:00
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td colspan="{{ num_pages + 2 }}">
|
|
|
|
<div>
|
|
|
|
<a href="?page={{ page - 1 }}&entities_per_page={{ entities_per_page }}">«</a>
|
|
|
|
{% for i in range(end=num_pages) %}
|
|
|
|
<a href="?page={{ i + 1 }}&entities_per_page={{ entities_per_page }}">{{ i + 1 }}</a>
|
|
|
|
{%- endfor %}
|
|
|
|
<a href="?page={{ page + 1 }}&entities_per_page={{ entities_per_page }}">»</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
2022-04-27 18:22:47 +02:00
|
|
|
</table>
|
2022-04-23 20:03:09 +02:00
|
|
|
{% endblock content %}
|