Skip to content

Commit

Permalink
two queries to avoid transferring drop data for 204/304
Browse files Browse the repository at this point in the history
  • Loading branch information
enkore committed Dec 7, 2016
1 parent 3cfc53e commit 4f69680
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drop_service/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4f69680

Please sign in to comment.