Simplify DB object management with Django CRUD helpers

This commit is contained in:
2022-10-29 12:43:13 +01:00
parent 8f705e2f25
commit c685b6d25f
26 changed files with 435 additions and 936 deletions

View File

@@ -10,7 +10,7 @@
<th>sandbox</th>
<th>actions</th>
</thead>
{% for item in items %}
{% for item in object_list %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
@@ -32,7 +32,7 @@
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'account_action' type=type account_id=item.id %}"
hx-get="{% url 'account_update' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
class="button is-info">
@@ -44,9 +44,10 @@
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{% url 'account_action' type=type account_id=item.id %}"
hx-delete="{% url 'account_delete' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#accounts-table"
hx-target="#modals-here"
hx-confirm="Are you sure you wish to delete {{ item.name }}?"
class="button is-danger">
<span class="icon-text">
<span class="icon">
@@ -55,7 +56,7 @@
</span>
</button>
{% if type == 'page' %}
<a href="{% url 'account_info' type=type account_id=item.id %}"><button
<a href="{% url 'account_info' type=type pk=item.id %}"><button
class="button is-success">
<span class="icon-text">
<span class="icon">
@@ -67,7 +68,7 @@
{% else %}
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'account_info' type=type account_id=item.id %}"
hx-get="{% url 'account_info' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
class="button is-success">