From b9045c530c05c216d067b4bbf7d1c0b4b41e20f6 Mon Sep 17 00:00:00 2001 From: Jim Driessen Date: Sun, 22 Jan 2017 18:24:44 +0100 Subject: [PATCH] Speed up retrieving songs. --- marietje/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/marietje/api/views.py b/marietje/api/views.py index 35e6d24..42a7a0d 100644 --- a/marietje/api/views.py +++ b/marietje/api/views.py @@ -35,7 +35,7 @@ def songs(request): title__icontains=request.POST.get('title', ''), user__name__icontains=request.POST.get('uploader', '') ).order_by('artist', 'title').select_related('user') - total = len(songs_query) + total = songs_query.count() paginator = Paginator(songs_query, pagesize) try: @@ -77,7 +77,7 @@ def managesongs(request): title__icontains=request.POST.get('title', '') ).order_by('artist', 'title') - total = len(songs_query) + total = songs_query.count() paginator = Paginator(songs_query, pagesize) try: