Skip to content

Commit

Permalink
fixed issue #2
Browse files Browse the repository at this point in the history
these changes induces a search bar which has the above mentioned qualities
  • Loading branch information
RITIK-CHAUDHRY committed Oct 17, 2024
1 parent 56ac3b0 commit ea1776d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion project/templates/project/project_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
<h2 class="">PROJECTS</h2>
</div>
</div>
<br>
<div class="row">
<div class="col-12 mb-3">
<input type="text" id="projectSearch" class="form-control" placeholder="Search projects...">
</div>
<!--start for-->
{% for project in projects %}
<div class="col-lg-4 col-md-6 d-flex align-items-stretch">
Expand Down
6 changes: 5 additions & 1 deletion project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ea1776d

Please sign in to comment.