Skip to content

Commit

Permalink
Merge pull request #6 from RITIK-CHAUDHRY/SEARCH_BAR
Browse files Browse the repository at this point in the history
fixed issue #2
  • Loading branch information
Avtech04 authored Oct 19, 2024
2 parents 56ac3b0 + ea1776d commit c63cbd8
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 c63cbd8

Please sign in to comment.