From: Kaltar5679 Date: Wed, 29 Apr 2015 08:19:27 +0000 (+0200) Subject: Patch advance search by code X-Git-Tag: 1.6a^2~15^2~80 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9746149371345927bcb27c3b210eeaaba1a2b7d9;p=telemeta.git Patch advance search by code --- diff --git a/src/django-haystack b/src/django-haystack index 97475f28..bd60745c 160000 --- a/src/django-haystack +++ b/src/django-haystack @@ -1 +1 @@ -Subproject commit 97475f2813a36e402296d5f2389fe10cd4cd1e0b +Subproject commit bd60745ce82318b1819768c9a31db0579228654d diff --git a/telemeta/forms/haystack_form.py b/telemeta/forms/haystack_form.py index 6ff97c0d..cc6d628b 100644 --- a/telemeta/forms/haystack_form.py +++ b/telemeta/forms/haystack_form.py @@ -72,7 +72,7 @@ class HayAdvanceFormCollection(SearchForm): class HayAdvanceForm(SearchForm): #to replace de basic search form field q = forms.CharField(required=False, label=('Title'), widget=forms.TextInput(attrs={'type': 'search'})) - cote = forms.CharField(required=False, label=('Cote'), widget=forms.TextInput(attrs={'type': 'search'})) + code = forms.CharField(required=False, label=('Code'), widget=forms.TextInput(attrs={'type': 'search'})) location = forms.CharField(required=False, label=('Location'), widget=forms.TextInput(attrs={'type': 'search'})) def search(self): @@ -84,8 +84,8 @@ class HayAdvanceForm(SearchForm): if self.cleaned_data.get('q'): sqs = sqs.filter(title__title__contains=self.cleaned_data['q']) - if self.cleaned_data.get('cote'): - sqs = sqs.filter(cote__cote__contains=self.cleaned_data['cote']) + if self.cleaned_data.get('code'): + sqs = sqs.filter(code__code__contains=self.cleaned_data['code']) if self.cleaned_data.get('location'): sqs = sqs.filter(location__location__contains=self.cleaned_data['location']) diff --git a/telemeta/templates/search/advanceSearch.html b/telemeta/templates/search/advanceSearch.html index 93fed061..216edb55 100644 --- a/telemeta/templates/search/advanceSearch.html +++ b/telemeta/templates/search/advanceSearch.html @@ -22,10 +22,10 @@ {% if query %}

{% trans "Results" %}

{% ifequal type 'item' %} -

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

+

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

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

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

+

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

{% endifequal %} {% endifequal %} {% with object_list as items %} @@ -35,9 +35,9 @@ {% if page.has_previous or page.has_next %}
- {% if page.has_previous %}{% endif %}« Previous{% if page.has_previous %}{% endif %} + {% if page.has_previous %}{% endif %}« Previous{% if page.has_previous %}{% endif %} | - {% if page.has_next %}{% endif %}Next »{% if page.has_next %}{% endif %} + {% if page.has_next %}{% endif %}Next »{% if page.has_next %}{% endif %}
{% endif %} {% endwith %} diff --git a/telemeta/views/haystack_search.py b/telemeta/views/haystack_search.py index 47127d6f..4b15af12 100644 --- a/telemeta/views/haystack_search.py +++ b/telemeta/views/haystack_search.py @@ -72,8 +72,8 @@ class HaystackAdvanceSearch(SearchView): if self.request.GET.get('q'): extra['title'] = self.request.GET['q'] - if self.request.GET.get('cote'): - extra['cote'] = self.request.GET['cote'] + if self.request.GET.get('code'): + extra['code'] = self.request.GET['code'] if self.request.GET.get('location'): extra['location'] = self.request.GET['location']