From ea1776d9dc77a55416d9317cbed7d0b4a2560769 Mon Sep 17 00:00:00 2001 From: RITIK CHAUDHRY Date: Fri, 18 Oct 2024 01:24:33 +0530 Subject: [PATCH] fixed issue #2 these changes induces a search bar which has the above mentioned qualities --- project/templates/project/project_list.html | 4 +++- project/views.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/project/templates/project/project_list.html b/project/templates/project/project_list.html index 690e588a..b2f7b944 100644 --- a/project/templates/project/project_list.html +++ b/project/templates/project/project_list.html @@ -17,8 +17,10 @@

PROJECTS

-
+
+ +
{% for project in projects %}
diff --git a/project/views.py b/project/views.py index fab7aec8..30f442cf 100644 --- a/project/views.py +++ b/project/views.py @@ -12,7 +12,11 @@ def list(request): context={} - project_all=Project.objects.get_queryset().order_by('id') + query = request.GET.get('q') + if query: + project_all = Project.objects.filter(title__icontains=query).order_by('id') + else: + project_all = Project.objects.get_queryset().order_by('id') page=request.GET.get('page') paginator=Paginator(project_all,9) projects=paginator.get_page(page)