From 5ff0c9fde50cd49499cdf7154ae5faa9976bf7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 31 Jan 2018 14:49:38 +0100 Subject: [PATCH] Use mass-attach of project pictures, and only when they are actually used --- attract/routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/attract/routes.py b/attract/routes.py index 2254028..0ab5182 100644 --- a/attract/routes.py +++ b/attract/routes.py @@ -7,7 +7,7 @@ import werkzeug.exceptions as wz_exceptions from pillar.auth import current_user as current_user from pillar.api.utils import str2id -from pillar.web.utils import attach_project_pictures +from pillar.web.utils import mass_attach_project_pictures import pillar.web.subquery from pillar.web.system_util import pillar_api from pillar.web.projects.routes import project_view @@ -36,8 +36,9 @@ def index(): # TODO: add projections. projects = current_attract.attract_projects() - for project in projects['_items']: - attach_project_pictures(project, api) + if current_user.is_anonymous: + # Headers are only shown in index_anon_left_column.pug + mass_attach_project_pictures(projects['_items'], square=False, api=api) projs_with_summaries = [ (proj, current_attract.shot_manager.shot_status_summary(proj['_id']))