Skip to content

Commit

Permalink
Merge branch 'ao994:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ak2466 authored Apr 22, 2024
2 parents ede2116 + 938fed6 commit 72a9ce1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Code/plant-pals/profile_of_user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .forms import ProfileForm, PlantForm
from django.contrib.auth.decorators import login_required
from django.db import IntegrityError
from django.db.models import Q

# for the forum page
def forum(request):
Expand Down Expand Up @@ -220,7 +221,7 @@ def search(request):
#defines what happens when there is a POST request
if request.method == "POST":
plant = request.POST.get("q")
search_result = Plant.objects.filter(common_name__icontains=plant)
search_result = Plant.objects.filter(Q(common_name__icontains=plant) | Q(scientific_name__icontains=plant))
return render(request, search_page, {'search_result':search_result })

#defines what happens when there is a GET request
Expand Down

0 comments on commit 72a9ce1

Please sign in to comment.