From 18f5558a75c61a4d3ca3c1feb7f8d9654548ab26 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 19 May 2016 16:02:27 -0400 Subject: [PATCH] Redirect from list on single result only if searching --- netbox/utilities/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index e3333997e..62a9f903b 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -49,8 +49,8 @@ class ObjectListView(View): messages.error(request, "There was an error rendering the selected export template ({})." .format(et.name)) - # Attempt to redirect automatically if the query returns a single result - if self.redirect_on_single_result and self.queryset.count() == 1: + # Attempt to redirect automatically if the search query returns a single result + if self.redirect_on_single_result and self.queryset.count() == 1 and request.GET: try: return HttpResponseRedirect(self.queryset[0].get_absolute_url()) except AttributeError: