From 73fa71e3809501cb7c85f1af8d151e8b33755fc3 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Fri, 31 Jan 2025 11:05:19 +0100 Subject: [PATCH] Use a with block rather than set to avoid leaking variables --- templates/wish/table.html | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/templates/wish/table.html b/templates/wish/table.html index 73a5eb8..3b03782 100644 --- a/templates/wish/table.html +++ b/templates/wish/table.html @@ -19,23 +19,24 @@ {% for item in table_collection %} - {% set retirement_date = retired.get(item.fields.set) %} - - {{ table.image(item.url_for_image(), caption=item.fields.name, alt=item.fields.set) }} - {{ item.fields.set }} {{ table.rebrickable(item) }} - {{ item.fields.name }} - {{ item.theme.name }} - {{ item.fields.year }} - {{ item.fields.number_of_parts }} - {% if retirement_date %}{{ retirement_date }}{% else %}Not found{% endif %} - {% if g.login.is_authenticated() %} - -
- -
- - {% endif %} - + {% with retirement_date = retired.get(item.fields.set) %} + + {{ table.image(item.url_for_image(), caption=item.fields.name, alt=item.fields.set) }} + {{ item.fields.set }} {{ table.rebrickable(item) }} + {{ item.fields.name }} + {{ item.theme.name }} + {{ item.fields.year }} + {{ item.fields.number_of_parts }} + {% if retirement_date %}{{ retirement_date }}{% else %}Not found{% endif %} + {% if g.login.is_authenticated() %} + +
+ +
+ + {% endif %} + + {% endwith %} {% endfor %}