From 586f2a7a0356fb247499c7c18db523ca60eeb6e2 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Fri, 22 Nov 2019 18:21:37 +0300 Subject: [PATCH] boost detail establishment speed (cherry picked from commit c2bb9f0) --- apps/establishment/models.py | 6 ++++-- project/settings/production.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/establishment/models.py b/apps/establishment/models.py index d22aebaa..cb490aa4 100644 --- a/apps/establishment/models.py +++ b/apps/establishment/models.py @@ -119,11 +119,13 @@ class EstablishmentQuerySet(models.QuerySet): 'address__city__country') def with_extended_related(self): - return self.select_related('establishment_type'). \ + return self.with_extended_address_related().select_related('establishment_type'). \ prefetch_related('establishment_subtypes', 'awards', 'schedule', - 'phones'). \ + 'phones', 'gallery', 'menu_set', 'menu_set__plate_set', + 'menu_set__plate_set__currency', 'currency'). \ prefetch_actual_employees() + def with_type_related(self): return self.prefetch_related('establishment_subtypes') diff --git a/project/settings/production.py b/project/settings/production.py index 3192acea..e745f3bc 100644 --- a/project/settings/production.py +++ b/project/settings/production.py @@ -51,4 +51,6 @@ GUESTONLINE_SERVICE = 'https://api.guestonline.fr/' GUESTONLINE_TOKEN = '' LASTABLE_SERVICE = '' LASTABLE_TOKEN = '' -LASTABLE_PROXY = '' \ No newline at end of file +LASTABLE_PROXY = '' + +THUMBNAIL_FORCE_OVERWRITE = True # see: https://github.com/jazzband/sorl-thumbnail/issues/351 \ No newline at end of file