Cache all object list templates
This commit is contained in:
@@ -1,33 +1,36 @@
|
||||
{% extends 'partials/generic-detail.html' %}
|
||||
{% load cache %}
|
||||
|
||||
{% block tbody %}
|
||||
{% for key, item in object.items %}
|
||||
<tr>
|
||||
{% if key == 'trade_ids' %}
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{% for trade_id in item %}
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'trade_action' type=type account_id=object.account_id trade_id=trade_id %}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modals-here"
|
||||
hx-swap="innerHTML"
|
||||
class="button is-small {% if trade_id in valid_trade_ids %}is-primary{% else %}is-warning{% endif %}">
|
||||
{{ trade_id }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% cache 600 object_position_detail request.user.id object %}
|
||||
{% for key, item in object.items %}
|
||||
<tr>
|
||||
{% if key == 'trade_ids' %}
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{% for trade_id in item %}
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'trade_action' type=type account_id=object.account_id trade_id=trade_id %}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modals-here"
|
||||
hx-swap="innerHTML"
|
||||
class="button is-small {% if trade_id in valid_trade_ids %}is-primary{% else %}is-warning{% endif %}">
|
||||
{{ trade_id }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
<th>{{ key }}</th>
|
||||
<td>
|
||||
{% if item is not None %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endcache %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user