#NEWLINE# def followup_edit( request , ticket_id , followup_id ) : #NEWLINE# #INDENT# 'Edit followup options with an ability to change the ticket.' #NEWLINE# followup = get_object_or_404 ( FollowUp , id = followup_id ) #NEWLINE# ticket = get_object_or_404 ( Ticket , id = ticket_id ) #NEWLINE# if ( not _has_access_to_queue ( request . user , ticket . queue ) ) : #NEWLINE# #INDENT# raise PermissionDenied ( ) #NEWLINE# #UNINDENT# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# form = EditFollowUpForm ( initial = { #NEWLINE# #INDENT# 'title' : escape ( followup . title ) , #NEWLINE# 'ticket' : followup . ticket , #NEWLINE# 'comment' : escape ( followup . comment ) , #NEWLINE# 'public' : followup . public , #NEWLINE# 'new_status' : followup . new_status , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( ticketcc_string , SHOW_SUBSCRIBE ) = return_ticketccstring_and_show_subscribe ( request . user , ticket ) #NEWLINE# return render_to_response ( 'helpdesk/followup_edit.html' , RequestContext ( request , { #NEWLINE# #INDENT# 'followup' : ticket , #NEWLINE# 'ticket' : ticket , #NEWLINE# 'form' : form , #NEWLINE# 'ticketcc_string' : ticketcc_string , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = EditFollowUpForm ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# title = form . cleaned_data [ 'title' ] #NEWLINE# _ticket = form . cleaned_data [ 'ticket' ] #NEWLINE# comment = form . cleaned_data [ 'comment' ] #NEWLINE# public = form . cleaned_data [ 'public' ] #NEWLINE# new_status = form . cleaned_data [ 'new_status' ] #NEWLINE# old_date = followup . date #NEWLINE# new_followup = FollowUp ( title = title , date = old_date , ticket = _ticket , comment = comment , public = public , new_status = new_status ) #NEWLINE# if followup . user : #NEWLINE# #INDENT# new_followup . user = followup . user #NEWLINE# #UNINDENT# new_followup . save ( ) #NEWLINE# attachments = Attachment . objects . filter ( followup = followup ) #NEWLINE# for attachment in attachments : #NEWLINE# #INDENT# attachment . followup = new_followup #NEWLINE# attachment . save ( ) #NEWLINE# #UNINDENT# followup . delete ( ) #NEWLINE# #UNINDENT# return HttpResponseRedirect ( reverse ( 'helpdesk_view' , args = [ ticket . id ] ) )