Use a with block rather than set to avoid leaking variables
This commit is contained in:
parent
4278e088a4
commit
73fa71e380
@ -19,23 +19,24 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for item in table_collection %}
|
{% for item in table_collection %}
|
||||||
{% set retirement_date = retired.get(item.fields.set) %}
|
{% with retirement_date = retired.get(item.fields.set) %}
|
||||||
<tr>
|
<tr>
|
||||||
{{ table.image(item.url_for_image(), caption=item.fields.name, alt=item.fields.set) }}
|
{{ table.image(item.url_for_image(), caption=item.fields.name, alt=item.fields.set) }}
|
||||||
<td>{{ item.fields.set }} {{ table.rebrickable(item) }}</td>
|
<td>{{ item.fields.set }} {{ table.rebrickable(item) }}</td>
|
||||||
<td>{{ item.fields.name }}</td>
|
<td>{{ item.fields.name }}</td>
|
||||||
<td>{{ item.theme.name }}</td>
|
<td>{{ item.theme.name }}</td>
|
||||||
<td>{{ item.fields.year }}</td>
|
<td>{{ item.fields.year }}</td>
|
||||||
<td>{{ item.fields.number_of_parts }}</td>
|
<td>{{ item.fields.number_of_parts }}</td>
|
||||||
<td>{% if retirement_date %}{{ retirement_date }}{% else %}<span class="badge rounded-pill text-bg-light border">Not found</span>{% endif %}</td>
|
<td>{% if retirement_date %}{{ retirement_date }}{% else %}<span class="badge rounded-pill text-bg-light border">Not found</span>{% endif %}</td>
|
||||||
{% if g.login.is_authenticated() %}
|
{% if g.login.is_authenticated() %}
|
||||||
<td>
|
<td>
|
||||||
<form action="{{ item.url_for_delete() }}" method="post">
|
<form action="{{ item.url_for_delete() }}" method="post">
|
||||||
<button type="submit" class="btn btn-sm btn-danger"><i class="ri-delete-bin-2-line"></i> Delete</button>
|
<button type="submit" class="btn btn-sm btn-danger"><i class="ri-delete-bin-2-line"></i> Delete</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user