#NEWLINE# @ admin . route ( '/issues/edit/<int:id>' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def issues_edit( id ) : #NEWLINE# #INDENT# issue = Issue . query . get ( id ) #NEWLINE# if ( ( request . method == 'GET' ) and issue and ( issue . status == 'unread' ) ) : #NEWLINE# #INDENT# issue = Issue . unread_to_open ( issue ) #NEWLINE# #UNINDENT# form = IssueForm ( obj = issue ) #NEWLINE# subject = _ ( '[Catwatch issue] Re: %(issue_type)s' , issue_type = issue . LABEL [ issue . label ] ) #NEWLINE# body_string = '\n\nYou opened an issue regarding:' #NEWLINE# issue_string = '\n\n---\n{0}\n---\n\n' . format ( issue . question ) #NEWLINE# message = _ ( 'Hello,%(body)s:%(issue)s\n\nThanks,\nCatwatch support team' , body = body_string , issue = issue_string ) #NEWLINE# contact_form = IssueContactForm ( email = issue . email , subject = subject , message = message ) #NEWLINE# if form . validate_on_submit ( ) : #NEWLINE# #INDENT# form . populate_obj ( issue ) #NEWLINE# issue . save ( ) #NEWLINE# flash ( _ ( 'Issue has been saved successfully.' ) , 'success' ) #NEWLINE# return redirect ( url_for ( 'admin.issues' ) ) #NEWLINE# #UNINDENT# return render_template ( 'admin/issue/edit.jinja2' , form = form , contact_form = contact_form , issue = issue )