From 1c4de8f364be7f643a1c8e066e07110b0d1544f6 Mon Sep 17 00:00:00 2001 From: afilsaime Date: Wed, 10 Jun 2015 15:46:03 +0200 Subject: [PATCH] add page change to advance search --- telemeta/templates/search/advanceSearch.html | 105 ++++++++++++++++--- telemeta/views/haystack_search.py | 5 + 2 files changed, 96 insertions(+), 14 deletions(-) diff --git a/telemeta/templates/search/advanceSearch.html b/telemeta/templates/search/advanceSearch.html index 973ca031..99c28b50 100644 --- a/telemeta/templates/search/advanceSearch.html +++ b/telemeta/templates/search/advanceSearch.html @@ -191,17 +191,37 @@
 
- - {% ifequal type 'item' %} -

Items ({{item_count}}) | Collections ({{collection_count}})

- {% else %} - {% ifequal type 'collection'%} -

Items ({{item_count}}) | Collections ({{collection_count}})

- {% endifequal %} - {% endifequal %} +
+
+ {% ifequal type 'item' %} +

Items ({{item_count}}) | Collections ({{collection_count}})

+ {% else %} + {% ifequal type 'collection'%} +

Items ({{item_count}}) | Collections ({{collection_count}})

+ {% endifequal %} + {% endifequal %} +
+
+
+ +
+ +
+
+
+
{% csrf_token %} {% with object_list as items %} -
+ + + {% endwith %} {% if user.is_authenticated %} @@ -226,6 +258,7 @@ diff --git a/telemeta/views/haystack_search.py b/telemeta/views/haystack_search.py index e43d303b..38ebd5f3 100644 --- a/telemeta/views/haystack_search.py +++ b/telemeta/views/haystack_search.py @@ -83,6 +83,10 @@ class HaystackAdvanceSearch(SearchView): def __call__(self, request, type=None): self.type = type + if request.GET.get('results_page'): + self.results_per_page=int(request.GET.get('results_page')) + else: + self.results_per_page = 20 return super(HaystackAdvanceSearch, self).__call__(request) def get_query(self): @@ -106,4 +110,5 @@ class HaystackAdvanceSearch(SearchView): extra['type'] = 'collection' else: extra['type'] = 'item' + extra['results_page']=self.results_per_page return extra -- 2.39.5