diff --git a/app.py b/app.py index 6b463d2..7b023bd 100644 --- a/app.py +++ b/app.py @@ -1336,6 +1336,21 @@ def main_page(): .order_by(ShoppingList.created_at.desc()) .all() ) + + # Definiujemy widoczny zakres list dla tego użytkownika + if current_user.is_authenticated: + visible_lists_query = ShoppingList.query.filter( + or_( + ShoppingList.owner_id == current_user.id, + ShoppingList.is_public == True + ) + ) + else: + visible_lists_query = ShoppingList.query.filter( + ShoppingList.is_public == True + ) + + # Teraz możemy bezpiecznie pobrać miesiące month_options = get_active_months_query(visible_lists_query) all_lists = user_lists + public_lists + archived_lists