added nickname to search
This commit is contained in:
parent
49fa15eb23
commit
a360ebcae6
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ from django.contrib.auth.decorators import login_required
|
|||
from fiches.models import Profile
|
||||
from fiches.forms import ProfileForm, SearchForm
|
||||
from django.urls import reverse
|
||||
from django.db.models import Q
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -32,7 +33,7 @@ def home(request):
|
|||
if request.method == 'POST':
|
||||
form = SearchForm(request.POST)
|
||||
if form.is_valid():
|
||||
result = Profile.objects.filter(full_name__icontains=form.cleaned_data['name'])
|
||||
result = Profile.objects.filter(Q(full_name__icontains=form.cleaned_data['name']) | Q(nickname__icontains=form.cleaned_data['name']))
|
||||
return render(request,'fiches/home.html',{"form":form, "result":result})
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue