mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Redirect from list on single result only if searching
This commit is contained in:
parent
e5efb7ddbd
commit
18f5558a75
@ -49,8 +49,8 @@ class ObjectListView(View):
|
|||||||
messages.error(request, "There was an error rendering the selected export template ({})."
|
messages.error(request, "There was an error rendering the selected export template ({})."
|
||||||
.format(et.name))
|
.format(et.name))
|
||||||
|
|
||||||
# Attempt to redirect automatically if the query returns a single result
|
# Attempt to redirect automatically if the search query returns a single result
|
||||||
if self.redirect_on_single_result and self.queryset.count() == 1:
|
if self.redirect_on_single_result and self.queryset.count() == 1 and request.GET:
|
||||||
try:
|
try:
|
||||||
return HttpResponseRedirect(self.queryset[0].get_absolute_url())
|
return HttpResponseRedirect(self.queryset[0].get_absolute_url())
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user