#NEWLINE# def edit( self , request , complaint_id = None ) : #NEWLINE# #INDENT# if ( complaint_id is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# complaint = Complaint . objects . pluggable_object ( request ) . get ( pk = complaint_id ) #NEWLINE# #UNINDENT# except Complaint . DoesNotExist : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# complaint = None #NEWLINE# #UNINDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = ComplaintForm ( request . POST , instance = complaint ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# complaint = form . save ( request ) #NEWLINE# return HttpResponseRedirect ( pluggable_reverse ( request , 'complaints_index' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = ComplaintForm ( instance = complaint ) #NEWLINE# #UNINDENT# return render_to_response ( request . pluggable . config . get ( 'template' , 'complaints/edit.html' ) , { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'base_template' : request . pluggable . config . get ( 'base_template' , 'base.html' ) , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( self ) )