#NEWLINE# def ticket_dependency_add( request , ticket_id ) : #NEWLINE# #INDENT# 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 == 'POST' ) : #NEWLINE# #INDENT# form = TicketDependencyForm ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# ticketdependency = form . save ( commit = False ) #NEWLINE# ticketdependency . ticket = ticket #NEWLINE# if ( ticketdependency . ticket != ticketdependency . depends_on ) : #NEWLINE# #INDENT# ticketdependency . save ( ) #NEWLINE# #UNINDENT# return HttpResponseRedirect ( reverse ( 'helpdesk_view' , args = [ ticket . id ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = TicketDependencyForm ( ) #NEWLINE# #UNINDENT# return render_to_response ( 'helpdesk/ticket_dependency_add.html' , RequestContext ( request , { #NEWLINE# #INDENT# 'ticket' : ticket , #NEWLINE# 'form' : form , #NEWLINE# #UNINDENT# } ) )