#NEWLINE# @ admin_required ( reviewers = True ) #NEWLINE# def addon_search( request ) : #NEWLINE# #INDENT# ctx = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( 'q' in request . GET ) : #NEWLINE# #INDENT# q = ctx [ 'q' ] = ctx . GET [ 'q' ] #NEWLINE# if q . isdigit ( ) : #NEWLINE# #INDENT# qs = Addon . objects . filter ( id = int ( q ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# qs = Addon . search ( ) . query ( name__text = q . lower ( ) ) . filter ( type__in = amo . ADDON_ADMIN_SEARCH_TYPES ) [ : 100 ] #NEWLINE# #UNINDENT# if ( len ( qs ) == 1 ) : #NEWLINE# #INDENT# return redirect ( 'zadmin.addon_manage' , qs [ 0 ] . id ) #NEWLINE# #UNINDENT# ctx [ 'addons' ] = qs #NEWLINE# #UNINDENT# return render ( request , 'zadmin/addon-search.html' , ctx )