Use ObjectRead helper for all list and detail views
This commit is contained in:
72
core/templates/partials/generic-detail.html
Normal file
72
core/templates/partials/generic-detail.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{% load pretty %}
|
||||
{% include 'partials/notify.html' %}
|
||||
|
||||
{% if live is not None %}
|
||||
<h1 class="title">Live {{ context_object_name_singular }} info</h1>
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<th>attribute</th>
|
||||
<th>value</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% block live_tbody %}
|
||||
{% for key, item in live.items %}
|
||||
{% if key in pretty %}
|
||||
<tr>
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
<pre>{{ item|pretty }}</pre>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if object is not None %}
|
||||
<h1 class="title">{{ title_singular }} info</h1>
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<th>attribute</th>
|
||||
<th>value</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% block tbody %}
|
||||
{% for key, item in object.items %}
|
||||
{% if key in pretty %}
|
||||
<tr>
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
<pre>{{ item|pretty }}</pre>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user