zapytanie sql
This commit is contained in:
13
app.py
13
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",
|
||||
|
@@ -110,14 +110,23 @@
|
||||
|
||||
|
||||
<div class="info-line ms-4 small d-flex flex-wrap gap-2" id="info-{{ item.id }}">
|
||||
{% set info_parts = [] %}
|
||||
{% if item.note %}
|
||||
<span class="text-danger">[ <b>{{ item.note }}</b> ]</span>
|
||||
{% set _ = info_parts.append('<span class="text-danger">[ <b>' ~ item.note ~ '</b> ]</span>') %}
|
||||
{% endif %}
|
||||
{% if item.not_purchased_reason %}
|
||||
<span class="text-dark">[ <b>Powód: {{ item.not_purchased_reason }}</b> ]</span>
|
||||
{% set _ = info_parts.append('<span class="text-dark">[ <b>Powód: ' ~ item.not_purchased_reason ~ '</b>
|
||||
]</span>') %}
|
||||
{% endif %}
|
||||
{% if item.added_by and item.owner_id and item.added_by_id and item.added_by_id != item.owner_id %}
|
||||
<span class="text-info">[ Dodał/a: <b>{{ item.added_by }}</b> ]</span>
|
||||
{% if item.added_by_display %}
|
||||
{% set _ = info_parts.append('<span class="text-info">[ Dodał/a: <b>' ~ item.added_by_display ~ '</b> ]</span>')
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
{% if info_parts %}
|
||||
<div class="info-line ms-4 small d-flex flex-wrap gap-2" id="info-{{ item.id }}">
|
||||
{{ info_parts | join(' ') | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
@@ -44,14 +44,23 @@
|
||||
</span>
|
||||
|
||||
<div class="info-line ms-4 small d-flex flex-wrap gap-2" id="info-{{ item.id }}">
|
||||
{% set info_parts = [] %}
|
||||
{% if item.note %}
|
||||
<span class="text-danger">[ <b>{{ item.note }}</b> ]</span>
|
||||
{% set _ = info_parts.append('<span class="text-danger">[ <b>' ~ item.note ~ '</b> ]</span>') %}
|
||||
{% endif %}
|
||||
{% if item.not_purchased_reason %}
|
||||
<span class="text-dark">[ <b>Powód: {{ item.not_purchased_reason }}</b> ]</span>
|
||||
{% set _ = info_parts.append('<span class="text-dark">[ <b>Powód: ' ~ item.not_purchased_reason ~ '</b>
|
||||
]</span>') %}
|
||||
{% endif %}
|
||||
{% if item.added_by and item.owner_id and item.added_by_id and item.added_by_id != item.owner_id %}
|
||||
<span class="text-info">[ Dodał/a: <b>{{ item.added_by }}</b> ]</span>
|
||||
{% if item.added_by_display %}
|
||||
{% set _ = info_parts.append('<span class="text-info">[ Dodał/a: <b>' ~ item.added_by_display ~ '</b> ]</span>')
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
{% if info_parts %}
|
||||
<div class="info-line ms-4 small d-flex flex-wrap gap-2" id="info-{{ item.id }}">
|
||||
{{ info_parts | join(' ') | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user