From 8ae45354f02de8f300002a1e5fe5b799bab56de8 Mon Sep 17 00:00:00 2001 From: Esther Kleinhenz Date: Thu, 30 Aug 2018 17:40:25 +0200 Subject: [PATCH] added TagSearch class but not using it atm --- .../templates/blog_search_list_view.html | 17 +++++++++++++++- application/views.py | 20 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/application/templates/blog_search_list_view.html b/application/templates/blog_search_list_view.html index ce9a98d..74cc6c8 100644 --- a/application/templates/blog_search_list_view.html +++ b/application/templates/blog_search_list_view.html @@ -11,7 +11,22 @@ {% include "taggit_templatetags2/tagcanvas_include_js_static.html" %} -{% include_tagcanvas 'tag-cloud' '200 px' '200 px' 'taggit_templatetags2' 'application.Post' %} +
+ +
+ + +
+
+ +
{% endblock %} \ No newline at end of file diff --git a/application/views.py b/application/views.py index bf5e760..0b9dac6 100644 --- a/application/views.py +++ b/application/views.py @@ -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', {})