From 4f69680be7b8d09540ceb8868d4db106323fc46d Mon Sep 17 00:00:00 2001 From: enkore Date: Wed, 7 Dec 2016 11:11:06 +0100 Subject: [PATCH] two queries to avoid transferring drop data for 204/304 --- drop_service/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drop_service/views.py b/drop_service/views.py index bf67232..ffc6450 100644 --- a/drop_service/views.py +++ b/drop_service/views.py @@ -44,14 +44,14 @@ def _get_drops(self, drop_id): if have_since: drops = drops.filter(created_at__gt=since) - drops = list(drops) - if not drops: + + if not drops.exists(): if have_since: return HttpResponseNotModified(), None else: return HttpResponse(status=status.HTTP_204_NO_CONTENT), None - return None, drops + return None, list(drops) def get(self, request, drop_id): response, drops = self._get_drops(drop_id)