#NEWLINE# @ admin . route ( '/edit' ) #NEWLINE# @ flask_login . login_required #NEWLINE# def edit_by_id( ) : #NEWLINE# #INDENT# id = request . args . get ( 'id' ) #NEWLINE# if ( not id ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# #UNINDENT# post = Post . load_by_id ( id ) #NEWLINE# if ( not post ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# #UNINDENT# type = 'post' #NEWLINE# if ( ( not request . args . get ( 'advanced' ) ) and post . post_type ) : #NEWLINE# #INDENT# type = post . post_type #NEWLINE# #UNINDENT# if template . draft : #NEWLINE# #INDENT# button_text = { #NEWLINE# #INDENT# 'publish' : 'Publish Draft' , #NEWLINE# 'publish_quietly' : 'Publish Draft Quietly' , #NEWLINE# 'publish+tweet' : 'Publish Draft & Tweet' , #NEWLINE# 'save_draft' : 'Resave Draft' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# button_text = { #NEWLINE# #INDENT# 'publish' : 'Republish' , #NEWLINE# 'publish_quietly' : 'Republish Quietly' , #NEWLINE# 'publish+tweet' : 'Republish & Tweet' , #NEWLINE# 'save_draft' : 'Unpublish, Save as Draft' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# template = ( ( 'admin/edit_' + type ) + '.jinja2' ) #NEWLINE# if request . args . get ( 'full' ) : #NEWLINE# #INDENT# template = 'admin/edit_post_all.jinja2' #NEWLINE# #UNINDENT# venues = Venue . query . order_by ( Venue . name ) . all ( ) #NEWLINE# return render_template ( template , edit_type = 'edit' , post = post , tags = get_tags ( ) , top_tags = get_top_tags ( 20 ) , people = get_contact_nicks ( ) , button_text = button_text , venues = venues )