Browse Source

added TagSearch class but not using it atm

newsletter
Esther Kleinhenz 5 years ago
parent
commit
8ae45354f0
2 changed files with 37 additions and 2 deletions
  1. 16
    1
      application/templates/blog_search_list_view.html
  2. 21
    1
      application/views.py

+ 16
- 1
application/templates/blog_search_list_view.html View File

@@ -11,7 +11,22 @@
</ul>
</div>
{% include "taggit_templatetags2/tagcanvas_include_js_static.html" %}
{% include_tagcanvas 'tag-cloud' '200 px' '200 px' 'taggit_templatetags2' 'application.Post' %}
<div id="tag-cloud">
</div>

<form type="get" action="." style="margin: 0">
<input id="search_box" type="text" name="search_box" placeholder="Search..." >
<button id="search_submit" type="submit" >Submit</button>
</form>
<div>
<ul>
{% for tag in tags %}
<li>
{{tag}}
</li>
{% endfor %}

</ul>
</div>
{% endblock %}

+ 21
- 1
application/views.py View File

@@ -119,7 +119,27 @@ def student_page(request):
return render(request, 'blog_search_list_view.html', {'result':result})


class TagSearch(TagCanvasListView):
template_name = 'blog_search_list_view.html'
model = Post
context_object_name = 'list'
paginate_by = 8
def get_context_data(self, **kwargs):
context = super(CustomerSearch, self).get_context_data(**kwargs)
context = self.get_queryset()
return context

def get_queryset(self):
cObj = Customer.objects.all()
var_get_search = self.request.GET.get('search_box')

if var_get_search is not None:
cObj = cObj.filter(firstname__icontains=var_get_search)
if var_get_order_by is not None:
cObj = cObj.order_by(var_get_order_by)
return cObj
def blog_search_list_view(request):
return render(request, 'blog_search_list_view.html', {})


Loading…
Cancel
Save