]> git.parisson.com Git - telemeta.git/commitdiff
Patch advance search by code
authorKaltar5679 <killian.mary@outlook.fr>
Wed, 29 Apr 2015 08:19:27 +0000 (10:19 +0200)
committerKaltar5679 <killian.mary@outlook.fr>
Wed, 29 Apr 2015 08:19:27 +0000 (10:19 +0200)
src/django-haystack
telemeta/forms/haystack_form.py
telemeta/templates/search/advanceSearch.html
telemeta/views/haystack_search.py

index 97475f2813a36e402296d5f2389fe10cd4cd1e0b..bd60745ce82318b1819768c9a31db0579228654d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 97475f2813a36e402296d5f2389fe10cd4cd1e0b
+Subproject commit bd60745ce82318b1819768c9a31db0579228654d
index 6ff97c0def4cce7b15ea1ec30e7dd623941b6db8..cc6d628b9db5aded07ab16c8509b9d9f355591c3 100644 (file)
@@ -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'])
index 93fed0610dd2351a8d76c8ed7e2e2f55c721ded7..216edb5588d99b22dbef1b4245eaa8779910ac13 100644 (file)
         {% if query %}
             <h1>{% trans "Results" %}</h1>
             {% ifequal type 'item' %}
-                 <p><b>Items ({{item_count}}) | <a href="{% url "haystack_advance_search_type" "collection" %}?q={{ query.q }}&cote={{ query.cote }}&location={{ query.location}}&amp;page=1">Collections ({{collection_count}})</a></b></p>
+                 <p><b>Items ({{item_count}}) | <a href="{% url "haystack_advance_search_type" "collection" %}?q={{ query.q }}&code={{ query.code }}&location={{ query.location}}&amp;page=1">Collections ({{collection_count}})</a></b></p>
              {% else %}
                 {% ifequal type 'collection'%}
-                    <p><b><a href="{% url "haystack_advance_search_type" "item" %}?q={{ query.q }}&cote={{ query.cote }}&location={{ query.location}}&amp;page=1">Items ({{item_count}}) </a>| Collections ({{collection_count}})</b></p>
+                    <p><b><a href="{% url "haystack_advance_search_type" "item" %}?q={{ query.q }}&code={{ query.code }}&location={{ query.location}}&amp;page=1">Items ({{item_count}}) </a>| Collections ({{collection_count}})</b></p>
                 {% endifequal %}
              {% endifequal %}
              {% with object_list as items %}
@@ -35,9 +35,9 @@
 
                 {% if page.has_previous or page.has_next %}
                     <div>
-                        {% if page.has_previous %}<a href="?q={{ query.q }}&cote={{ query.cote }}&location={{ query.location}}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
+                        {% if page.has_previous %}<a href="?q={{ query.q }}&code={{ query.code }}&location={{ query.location}}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
                         |
-                        {% if page.has_next %}<a href="?q={{ query.q }}&cote={{ query.cote }}&location={{ query.location}}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
+                        {% if page.has_next %}<a href="?q={{ query.q }}&code={{ query.code }}&location={{ query.location}}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
                     </div>
                 {% endif %}
             {% endwith %}
index 47127d6f96c592e74701fc9027bd8eb6d0c76abb..4b15af12a2c33212a409275e38c8ce25ba7ffc3b 100644 (file)
@@ -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']