#NEWLINE# @ transaction . commit_on_success #NEWLINE# def home( request ) : #NEWLINE# #INDENT# logger = logging . getLogger ( 'peavy_demo.views.home' ) #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = QuoteForm ( form . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# quote = form . save ( ) #NEWLINE# logger . info ( 'Quote from {0} in {1} submitted by {2}' . format ( quote . character , quote . show , quote . submitter ) ) #NEWLINE# return HttpResponseRedirect ( reverse ( 'home' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = QuoteForm ( ) #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'quotes' : Quote . objects . all ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# return render_to_response ( 'home.html' , data , context_instance = RequestContext ( request ) )