diff --git a/app.py b/app.py
index e4d3b74..9a89b35 100644
--- a/app.py
+++ b/app.py
@@ -1196,11 +1196,10 @@ def view_list(list_id):
is_owner = current_user.id == shopping_list.owner_id
for item in items:
- if item.added_by_id != item.owner_id:
- item.added_by = item.added_by_user.username if item.added_by_user else "?"
+ if item.added_by != shopping_list.owner_id:
+ item.added_by_display = item.added_by_user.username if item.added_by_user else "?"
else:
- item.added_by = None
-
+ item.added_by_display = None
return render_template(
"list.html",
@@ -1330,10 +1329,10 @@ def shared_list(token=None, list_id=None):
)
for item in items:
- if item.added_by_id != item.owner_id:
- item.added_by = item.added_by_user.username if item.added_by_user else "?"
+ if item.added_by != shopping_list.owner_id:
+ item.added_by_display = item.added_by_user.username if item.added_by_user else "?"
else:
- item.added_by = None
+ item.added_by_display = None
return render_template(
"list_share.html",
diff --git a/templates/list.html b/templates/list.html
index b500a7f..7cf69f1 100644
--- a/templates/list.html
+++ b/templates/list.html
@@ -110,14 +110,23 @@
+ {% set info_parts = [] %}
{% if item.note %}
-
[ {{ item.note }} ]
+ {% set _ = info_parts.append('
[ ' ~ item.note ~ ' ]') %}
{% endif %}
{% if item.not_purchased_reason %}
-
[ Powód: {{ item.not_purchased_reason }} ]
+ {% set _ = info_parts.append('
[ Powód: ' ~ item.not_purchased_reason ~ '
+ ]') %}
{% endif %}
- {% if item.added_by and item.owner_id and item.added_by_id and item.added_by_id != item.owner_id %}
-
[ Dodał/a: {{ item.added_by }} ]
+ {% if item.added_by_display %}
+ {% set _ = info_parts.append('
[ Dodał/a: ' ~ item.added_by_display ~ ' ]')
+ %}
+ {% endif %}
+
+ {% if info_parts %}
+
+ {{ info_parts | join(' ') | safe }}
+
{% endif %}
diff --git a/templates/list_share.html b/templates/list_share.html
index 7bde4af..3f9aaf3 100644
--- a/templates/list_share.html
+++ b/templates/list_share.html
@@ -44,14 +44,23 @@
+ {% set info_parts = [] %}
{% if item.note %}
-
[ {{ item.note }} ]
+ {% set _ = info_parts.append('
[ ' ~ item.note ~ ' ]') %}
{% endif %}
{% if item.not_purchased_reason %}
-
[ Powód: {{ item.not_purchased_reason }} ]
+ {% set _ = info_parts.append('
[ Powód: ' ~ item.not_purchased_reason ~ '
+ ]') %}
{% endif %}
- {% if item.added_by and item.owner_id and item.added_by_id and item.added_by_id != item.owner_id %}
-
[ Dodał/a: {{ item.added_by }} ]
+ {% if item.added_by_display %}
+ {% set _ = info_parts.append('
[ Dodał/a: ' ~ item.added_by_display ~ ' ]')
+ %}
+ {% endif %}
+
+ {% if info_parts %}
+
+ {{ info_parts | join(' ') | safe }}
+
{% endif %}