diff --git a/app.py b/app.py index 11df39b..e05bf99 100644 --- a/app.py +++ b/app.py @@ -951,9 +951,11 @@ def save_pdf_as_webp(file, path): def get_active_months_query(visible_lists_query=None): - if db.engine.name == "sqlite": + if db.engine.name in ("sqlite",): month_col = func.strftime("%Y-%m", ShoppingList.created_at) - else: + elif db.engine.name in ("mysql", "mariadb"): + month_col = func.date_format(ShoppingList.created_at, "%Y-%m") + else: # PostgreSQL i inne wspierajÄ…ce to_char month_col = func.to_char(ShoppingList.created_at, "YYYY-MM") query = db.session.query(month_col.label("month"))