spojosc i poprawki
This commit is contained in:
30
app.py
30
app.py
@@ -1550,29 +1550,6 @@ def system_auth():
|
||||
return render_template("system_auth.html")
|
||||
|
||||
|
||||
@app.route("/toggle_archive_list/<int:list_id>")
|
||||
@login_required
|
||||
def toggle_archive_list(list_id):
|
||||
l = db.session.get(ShoppingList, list_id)
|
||||
if l is None:
|
||||
abort(404)
|
||||
|
||||
if l.owner_id != current_user.id:
|
||||
return redirect_with_flash("Nie masz uprawnień do tej listy", "danger")
|
||||
|
||||
archive = request.args.get("archive", "true").lower() == "true"
|
||||
|
||||
if archive:
|
||||
l.is_archived = True
|
||||
flash(f"Lista „{l.title}” została zarchiwizowana.", "success")
|
||||
else:
|
||||
l.is_archived = False
|
||||
flash(f"Lista „{l.title}” została przywrócona.", "success")
|
||||
|
||||
db.session.commit()
|
||||
return redirect(url_for("main_page"))
|
||||
|
||||
|
||||
@app.route("/edit_my_list/<int:list_id>", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def edit_my_list(list_id):
|
||||
@@ -1595,6 +1572,13 @@ def edit_my_list(list_id):
|
||||
next_page = request.args.get("next") or request.referrer
|
||||
|
||||
if request.method == "POST":
|
||||
if "unarchive" in request.form:
|
||||
l.is_archived = False
|
||||
db.session.commit()
|
||||
flash(f"Lista „{l.title}” została przywrócona.", "success")
|
||||
return redirect(next_page or url_for("main_page"))
|
||||
|
||||
# Pełna edycja formularza
|
||||
move_to_month = request.form.get("move_to_month")
|
||||
if move_to_month:
|
||||
try:
|
||||
|
Reference in New Issue
Block a user