#NEWLINE# @ allow_build #NEWLINE# def build_bulk( request ) : #NEWLINE# #INDENT# systems = models . System . build_objects . filter ( id__in = request . GET . getlist ( 'system_id' ) ) #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# save_fields = [ f for f in request . POST . getlist ( 'save_field' ) if ( f in BuildAttributeForm . Meta . fields ) ] #NEWLINE# if build_attribute_form_generator ( save_fields ) ( request . POST ) . is_valid ( ) : #NEWLINE# #INDENT# for s in systems : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# build_attribute = s . buildattribute #NEWLINE# #UNINDENT# except models . BuildAttribute . DoesNotExist : #NEWLINE# #INDENT# build_attribute = None #NEWLINE# #UNINDENT# form = build_attribute_form_generator ( save_fields ) ( request . POST , instance = build_attribute ) #NEWLINE# ba = form . save ( commit = False ) #NEWLINE# ba . system = s #NEWLINE# ba . save ( ) #NEWLINE# form . save_m2m ( ) #NEWLINE# #UNINDENT# return redirect ( build_list ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# form = BuildAttributeForm ( request . POST ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = BuildAttributeForm ( ) #NEWLINE# #UNINDENT# return render_to_response ( 'build/bulk.html' , { #NEWLINE# #INDENT# 'systems' : systems , #NEWLINE# 'form' : form , #NEWLINE# #UNINDENT# } , RequestContext ( request ) )