zmiany w edycji listy przez usera

This commit is contained in:
Mateusz Gruszczyński
2025-08-15 13:07:10 +02:00
parent 977b8630fb
commit 1f2fc60683
2 changed files with 8 additions and 2 deletions

6
app.py
View File

@@ -1574,6 +1574,10 @@ def edit_my_list(list_id):
db.session.commit()
flash("Zaktualizowano dane listy", "success")
return redirect(next_page or url_for("main_page"))
now = datetime.now()
current_year = now.year
current_month = f"{now.month:02d}"
return render_template(
"edit_my_list.html",
@@ -1581,6 +1585,8 @@ def edit_my_list(list_id):
receipts=receipts,
categories=categories,
selected_categories=selected_categories_ids,
current_year=current_year,
current_month=current_month
)

View File

@@ -67,12 +67,12 @@
<div class="d-flex gap-2">
<select id="move_to_month_year" class="form-select bg-dark text-white border-secondary rounded">
{% for y in range(2022, 2031) %}
<option value="{{ y }}" {% if y == (selected_year or now().year) %}selected{% endif %}>{{ y }}</option>
<option value="{{ y }}" {% if y == (selected_year or current_year) %}selected{% endif %}>{{ y }}</option>
{% endfor %}
</select>
<select id="move_to_month_month" class="form-select bg-dark text-white border-secondary rounded">
{% for m in range(1, 13) %}
<option value="{{ "%02d"|format(m) }}" {% if m == (selected_month or now().month) %}selected{% endif %}>{{ "%02d"|format(m) }}</option>
<option value="{{ "%02d"|format(m) }}" {% if "%02d"|format(m) == (selected_month or current_month) %}selected{% endif %}>{{ "%02d"|format(m) }}</option>
{% endfor %}
</select>
</div>