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', '')
|
||||
|
||||
results = apply_smart_search(query, Item.objects)
|
||||
|
||||
if results.count() == 1:
|
||||
return redirect(results.all()[0])
|
||||
|
||||
return render(request, 'results.html', {
|
||||
'query': query,
|
||||
'results': results.all(),
|
||||
|
|
Loading…
Reference in New Issue