From: mathieu Date: Fri, 29 Apr 2016 08:03:45 +0000 (+0200) Subject: Fix url inexistant recherche avancée X-Git-Tag: 1.6.2^2~15^2~6^2~17 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=64e2758e40b724524c9798dfe11a53c2074b0e67;p=telemeta.git Fix url inexistant recherche avancée Lien type résultats avec page=1 --- diff --git a/telemeta/templates/search/advanceSearch.html b/telemeta/templates/search/advanceSearch.html index 9e0ac8df..5ba73ce7 100644 --- a/telemeta/templates/search/advanceSearch.html +++ b/telemeta/templates/search/advanceSearch.html @@ -168,16 +168,16 @@
{% ifequal type 'item' %} -

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

+

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

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

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

+

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

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

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

+

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

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

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

+

Items ({{item_count}}) | Collections ({{collection_count}}) | Corpus ({{corpus_count}}) | Fonds ({{fonds_count}})

{% endifequal %} {% endifequal %} {% endifequal %} diff --git a/telemeta/views/search.py b/telemeta/views/search.py index 37d21efd..4b6f18fd 100644 --- a/telemeta/views/search.py +++ b/telemeta/views/search.py @@ -26,6 +26,7 @@ import simplejson as json from django.http import HttpResponse from telemeta.forms.boolean_form import * from django.forms.formsets import formset_factory +import re class HaystackSearch(FacetedSearchView, SavedSearchView): @@ -124,6 +125,7 @@ class HaystackAdvanceSearch(SavedSearchView): self.results_per_page = int(request.GET.get('results_page')) else: self.results_per_page = 20 + self.requestURL = re.sub('&page=\d+', '&page=1', request.GET.urlencode()) return super(HaystackAdvanceSearch, self).__call__(request) def get_query(self): @@ -160,6 +162,7 @@ class HaystackAdvanceSearch(SavedSearchView): extra['results_page'] = self.results_per_page extra['booleanForm'] = formset_factory(BooleanSearch, extra=2) + extra['request_url'] = self.requestURL return extra def autocomplete(request):