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>received hooks</th>
<th>actions</th>
</thead>
{% for item in items %}
{% for item in object_list %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
@@ -22,7 +22,7 @@
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'hook_action' type=type hook_id=item.id %}"
hx-get="{% url 'hook_update' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
class="button is-info">
@@ -34,9 +34,10 @@
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{% url 'hook_action' type=type hook_id=item.id %}"
hx-delete="{% url 'hook_delete' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#hooks-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">
@@ -45,7 +46,7 @@
</span>
</button>
{% if type == 'page' %}
<a href="{% url 'callbacks' type='page' hook_id=item.id %}"><button
<a href="{% url 'callbacks' type='page' pk=item.id %}"><button
class="button is-success">
<span class="icon-text">
<span class="icon">
@@ -57,7 +58,7 @@
{% else %}
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'callbacks' type=type hook_id=item.id %}"
hx-get="{% url 'callbacks' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
class="button is-success">