#NEWLINE# @ login_required #NEWLINE# def published_to_edited( request , id ) : #NEWLINE# #INDENT# def transform( entry ) : #NEWLINE# #INDENT# dict = entry . __dict__ . copy ( ) #NEWLINE# dict [ 'edited' ] = True #NEWLINE# del dict [ 'body_html' ] #NEWLINE# del dict [ 'id' ] #NEWLINE# draft = Draft ( ** dict ) #NEWLINE# draft . save ( ) #NEWLINE# for field in MANY_TO_MANY_FIELDS : #NEWLINE# #INDENT# getattr ( draft , field ) . add ( * getattr ( entry , field ) . all ( ) ) #NEWLINE# #UNINDENT# return draft #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# entry = Entry . objects . get ( pk = id ) #NEWLINE# draft = transform ( entry ) #NEWLINE# entry . delete ( ) #NEWLINE# return HttpResponse ( ( '%s' % draft . pk ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return HttpResponseServerError ( 'Update failed.' )