#NEWLINE# def formset_view( request ) : #NEWLINE# #INDENT# 'A view that tests a simple formset' #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# formset = TestFormSet ( request . POST ) #NEWLINE# if formset . is_valid ( ) : #NEWLINE# #INDENT# t = Template ( 'Valid POST data.' , name = 'Valid POST Template' ) #NEWLINE# c = Context ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t = Template ( 'Invalid POST data. {{ my_formset.errors }}' , name = 'Invalid POST Template' ) #NEWLINE# c = Context ( { #NEWLINE# #INDENT# 'my_formset' : t , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# formset = TestForm ( request . GET ) #NEWLINE# t = Template ( 'Viewing base formset. {{ my_formset }}.' , name = 'Formset GET Template' ) #NEWLINE# c = Context ( { #NEWLINE# #INDENT# 'my_formset' : formset , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return HttpResponse ( t . render ( c ) )