search: Redirect directly to item page on single search result
This commit is contained in:
parent
0f6fe5002d
commit
fe1c6685b0
|
@ -49,6 +49,10 @@ def search(request):
|
||||||
query = request.GET.get('q', '')
|
query = request.GET.get('q', '')
|
||||||
|
|
||||||
results = apply_smart_search(query, Item.objects)
|
results = apply_smart_search(query, Item.objects)
|
||||||
|
|
||||||
|
if results.count() == 1:
|
||||||
|
return redirect(results.all()[0])
|
||||||
|
|
||||||
return render(request, 'results.html', {
|
return render(request, 'results.html', {
|
||||||
'query': query,
|
'query': query,
|
||||||
'results': results.all(),
|
'results': results.all(),
|
||||||
|
|
Loading…
Reference in New Issue