#NEWLINE# def populate_cluster_template_choices( self , request , context ) : #NEWLINE# #INDENT# templates = saharaclient . cluster_template_list ( request ) #NEWLINE# ( plugin , hadoop_version ) = whelpers . get_plugin_and_hadoop_version ( request ) #NEWLINE# choices = [ ( template . id , template . name ) for template in templates if ( ( template . hadoop_version == hadoop_version ) and ( template . plugin_name == plugin ) ) ] #NEWLINE# if ( not choices ) : #NEWLINE# #INDENT# choices . append ( ( '' , _ ( 'No Templates Available' ) ) ) #NEWLINE# #UNINDENT# selected_template_id = request . REQUEST . get ( 'cluster_template_id' , None ) #NEWLINE# for template in templates : #NEWLINE# #INDENT# if ( template . id == selected_template_id ) : #NEWLINE# #INDENT# self . fields [ 'cluster_template' ] . initial = template . id #NEWLINE# #UNINDENT# #UNINDENT# return choices