@@ -2846,7 +2846,7 @@ def get_context_data(self, **kwargs):
28462846 return context
28472847
28482848
2849- class ProjectResourceSearchView (
2849+ class ProjectResourceTreeSearchView (
28502850 ConditionalLoginRequired ,
28512851 ProjectRelatedViewMixin ,
28522852 generic .ListView ,
@@ -2856,22 +2856,25 @@ class ProjectResourceSearchView(
28562856 context_object_name = "search_results"
28572857 paginate_by = 30
28582858
2859+ def setup (self , request , * args , ** kwargs ):
2860+ super ().setup (request , * args , ** kwargs )
2861+ self .search_query = request .GET .get ("search" , "" ).strip ()
2862+
28592863 def get_queryset (self ):
2860- search_query = self .request .GET .get ("search" , "" ).strip ()
2861- if not search_query :
2864+ if not self .search_query :
28622865 return super ().get_queryset ().none ()
28632866
28642867 return (
28652868 super ()
28662869 .get_queryset ()
2867- .filter (path__icontains = search_query )
2870+ .filter (path__icontains = self . search_query )
28682871 .only ("project_id" , "path" , "type" )
28692872 .order_by ("path" )
28702873 )
28712874
28722875 def get_context_data (self , ** kwargs ):
28732876 context = super ().get_context_data (** kwargs )
2874- context ["query" ] = self .request . GET . get ( "search" , "" ). strip ()
2877+ context ["query" ] = self .search_query
28752878 return context
28762879
28772880
0 commit comments