@handle_response_format
@treeio_login_required
def ticket_delete(request, ticket_id, response_format='html'):
 ticket = get_object_or_404(Ticket, pk=ticket_id)
 if (not request.user.profile.has_permission(ticket, mode='w')):
  return user_denied(request, message="You don't have access to this Ticket")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    ticket.trash = True
    ticket.save()
   else:
    ticket.delete()
   return HttpResponseRedirect(reverse('services_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('services_ticket_view', args=[ticket.id]))
 context = _get_default_context(request)
 context.update({'ticket': ticket})
 return render_to_response('services/ticket_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def ticket_delete ( request , ticket_id , response_format = 'html' ) : ticket = get_object_or_404 ( Ticket , pk = ticket_id ) if ( not request . user . profile . has_permission ( ticket , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Ticket" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : ticket . trash = True ticket . save ( ) else : ticket . delete ( ) return HttpResponseRedirect ( reverse ( 'services_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'services_ticket_view' , args = [ ticket . id ] ) ) context = _get_default_context ( request ) context . update ( { 'ticket' : ticket } ) return render_to_response ( 'services/ticket_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
ticket delete .