Simplify DB object management with Django CRUD helpers
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<th>SL</th>
|
||||
<th>actions</th>
|
||||
</thead>
|
||||
{% for item in items %}
|
||||
{% for item in object_list %}
|
||||
<tr>
|
||||
<td>{{ item.id }}</td>
|
||||
<td>{{ item.name }}</td>
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="buttons">
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'strategies_action' type=type strategy_id=item.id %}"
|
||||
hx-get="{% url 'strategy_update' type=type pk=item.id %}"
|
||||
hx-trigger="click"
|
||||
hx-target="#{{ type }}s-here"
|
||||
class="button is-info">
|
||||
@@ -46,9 +46,10 @@
|
||||
</button>
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-delete="{% url 'strategies_action' type=type strategy_id=item.id %}"
|
||||
hx-delete="{% url 'strategy_delete' type=type pk=item.id %}"
|
||||
hx-trigger="click"
|
||||
hx-target="#strategies-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">
|
||||
@@ -57,7 +58,7 @@
|
||||
</span>
|
||||
</button>
|
||||
{% if type == 'page' %}
|
||||
<a href="{% url 'strategies_action' type=type strategy_id=item.id %}"><button
|
||||
<a href="#"><button
|
||||
class="button is-success">
|
||||
<span class="icon-text">
|
||||
<span class="icon">
|
||||
@@ -69,7 +70,7 @@
|
||||
{% else %}
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'strategies_action' type=type strategy_id=item.id %}"
|
||||
hx-get="#"
|
||||
hx-trigger="click"
|
||||
hx-target="#{{ type }}s-here"
|
||||
class="button is-success">
|
||||
|
||||
Reference in New Issue
Block a user