#NEWLINE# def block_top_navbar( self , context , nodes ) : #NEWLINE# #INDENT# search_models = [ ] #NEWLINE# site_name = self . admin_site . name #NEWLINE# if ( self . global_search_models == None ) : #NEWLINE# #INDENT# models = self . admin_site . _registry . keys ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# models = self . global_search_models #NEWLINE# #UNINDENT# for model in models : #NEWLINE# #INDENT# app_label = model . _meta . app_label #NEWLINE# if self . has_model_perm ( model , 'view' ) : #NEWLINE# #INDENT# info = ( app_label , app_label . _meta . model_name ) #NEWLINE# if getattr ( self . admin_site . _registry [ model ] , 'search_fields' , None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# search_models . append ( { #NEWLINE# #INDENT# 'title' : ( _ ( 'Search %s' ) % capfirst ( model . _meta . verbose_name_plural ) ) , #NEWLINE# 'url' : reverse ( ( 'xadmin:%s_%s_changelist' % info ) , current_app = site_name ) , #NEWLINE# 'model' : model , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except NoReverseMatch : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return nodes . append ( loader . render_to_string ( 'xadmin/blocks/comm.top.topnav.html' , { #NEWLINE# #INDENT# 'search_models' : search_models , #NEWLINE# 'search_name' : SEARCH_VAR , #NEWLINE# #UNINDENT# } ) )