CRUDkit fixes and changes.
This commit is contained in:
parent
9d36d600bb
commit
7ddfe084ba
5 changed files with 98 additions and 43 deletions
|
|
@ -1,12 +1,20 @@
|
|||
<table>
|
||||
{% if objects %}
|
||||
{% if rows %}
|
||||
<thead>
|
||||
<tr>
|
||||
{% for field in objects[0].__table__.columns %}<th>{{ field.name }}</th>{% endfor %}
|
||||
{% if headers %}
|
||||
{% for header in headers %}<th>{{ header }}</th>{% endfor %}
|
||||
{% else %}
|
||||
{% for field in fields if field != "id" %}<th>{{ field }}</th>{% endfor %}
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% for obj in objects %}
|
||||
<tr>{% for field in obj.__table__.columns %}<td>{{ obj[field.name] }}</td>{% endfor %}</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
<tr>{% for _, cell in row.items() if _ != "id" %}<td>{{ cell if cell else "-" }}</td>{% endfor %}</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr><th>No data.</th></tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr><th>No data.</th></tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue