fix przy nie wybraniu kategorii
This commit is contained in:
13
app.py
13
app.py
@@ -442,12 +442,17 @@ def get_total_expense_for_list(list_id, start_date=None, end_date=None):
|
||||
return query.scalar() or 0
|
||||
|
||||
|
||||
|
||||
def update_list_categories_from_form(shopping_list, form):
|
||||
category_ids = form.getlist("categories")
|
||||
cat = form.get("categories")
|
||||
shopping_list.categories.clear()
|
||||
if category_ids:
|
||||
cats = Category.query.filter(Category.id.in_(category_ids)).all()
|
||||
shopping_list.categories.extend(cats)
|
||||
if cat:
|
||||
try:
|
||||
cid = int(cat)
|
||||
cats = Category.query.filter(Category.id == cid).all()
|
||||
shopping_list.categories.extend(cats)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
def generate_share_token(length=8):
|
||||
|
Reference in New Issue
Block a user