#NEWLINE# def create_form( form_objects , name , request_data , id , args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# ' Helper function for creating form object ' #NEWLINE# if ( not ( name in form_objects ) ) : #NEWLINE# #INDENT# raise Http404 ( ) #NEWLINE# #UNINDENT# if id : #NEWLINE# #INDENT# instance = form_objects [ name ] . Meta . model . objects . get ( pk = id ) #NEWLINE# form = form_objects [ name ] ( ( request_data or None ) , instance = instance ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# instance = form_objects [ name ] . Meta . model ( ** request_data ) #NEWLINE# form = form_objects [ name ] ( ( request_data or None ) , instance = instance ) #NEWLINE# #UNINDENT# return form