zmiany ux oraz nowe funkcje
This commit is contained in:
24
app.py
24
app.py
@@ -1748,6 +1748,18 @@ def create_list():
|
||||
@app.route("/list/<int:list_id>")
|
||||
@login_required
|
||||
def view_list(list_id):
|
||||
|
||||
shopping_list = db.session.get(ShoppingList, list_id)
|
||||
if not shopping_list:
|
||||
abort(404)
|
||||
|
||||
is_owner = current_user.id == shopping_list.owner_id
|
||||
if not is_owner:
|
||||
flash("Nie jesteś właścicielem listy, przekierowano do widoku publicznego.", "warning")
|
||||
if current_user.is_admin:
|
||||
flash("W celu modyfikacji listy, przejdź do panelu administracyjnego.", "info")
|
||||
return redirect(url_for("shared_list", token=shopping_list.share_token))
|
||||
|
||||
shopping_list, items, receipt_files, expenses, total_expense = get_list_details(
|
||||
list_id
|
||||
)
|
||||
@@ -2541,6 +2553,10 @@ def add_user():
|
||||
flash("Wypełnij wszystkie pola", "danger")
|
||||
return redirect(url_for("list_users"))
|
||||
|
||||
if len(password) < 6:
|
||||
flash("Hasło musi mieć co najmniej 6 znaków", "danger")
|
||||
return redirect(url_for("list_users"))
|
||||
|
||||
if User.query.filter(func.lower(User.username) == username).first():
|
||||
flash("Użytkownik o takiej nazwie już istnieje", "warning")
|
||||
return redirect(url_for("list_users"))
|
||||
@@ -2689,6 +2705,12 @@ def admin_receipts(id):
|
||||
flash("Nieprawidłowe ID listy.", "danger")
|
||||
return redirect(url_for("admin_panel"))
|
||||
|
||||
total_filesize = (
|
||||
db.session.query(func.sum(Receipt.filesize)).scalar() or 0
|
||||
)
|
||||
|
||||
page_filesize = sum(r.filesize or 0 for r in receipts_paginated)
|
||||
|
||||
query_string = urlencode({k: v for k, v in request.args.items() if k != "page"})
|
||||
|
||||
return render_template(
|
||||
@@ -2701,6 +2723,8 @@ def admin_receipts(id):
|
||||
total_pages=total_pages,
|
||||
id=id,
|
||||
query_string=query_string,
|
||||
total_filesize=total_filesize,
|
||||
page_filesize=page_filesize,
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user