From 02a2d00f9dcc8ebf629e839230cc0136eb6ae946 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 1 Aug 2019 15:36:06 +0200 Subject: [PATCH] fix findPlace performance --- pandora/place/managers.py | 1 + pandora/place/views.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/place/managers.py b/pandora/place/managers.py index ad824591..75d59b1d 100644 --- a/pandora/place/managers.py +++ b/pandora/place/managers.py @@ -141,4 +141,5 @@ class PlaceManager(Manager): user) if conditions: qs = qs.filter(conditions) + qs = qs.distinct() return qs diff --git a/pandora/place/views.py b/pandora/place/views.py index 9b9ba72f..0b4c105a 100644 --- a/pandora/place/views.py +++ b/pandora/place/views.py @@ -239,7 +239,6 @@ def findPlaces(request, data): qs = order_query(query['qs'], query['sort']) qs = qs.distinct() if 'keys' in data: - qs = qs.select_related('user__profile') qs = qs[query['range'][0]:query['range'][1]] response['data']['items'] = [p.json(data['keys'], request.user) for p in qs] elif 'position' in query: