Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def search(request):
- form = SearchForm(request.GET)
- if request.method == 'GET':
- if form.is_valid():
- q = request.GET.get('search')
- print(q)
- a = Trailer.objects.filter(title_trailer=q)
- if not a:
- return render(request, "polls/search.html", {'no_result': 'Нету результатов'})
- else:
- a = a.values('title_trailer', 'preview_trailer', 'trailer', 'author_id')
- return render(request, 'polls/search.html', {'result_search': a})
- return render(request, 'polls/search.html', {'form': form})
Advertisement
Add Comment
Please, Sign In to add comment