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

@ handle_response_format @ treeio_login_required def agent_delete ( request , agent_id , response_format = 'html' ) : view_agent = get_object_or_404 ( ServiceAgent , pk = agent_id ) if ( not request . user . profile . has_permission ( view_agent , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Service Agent" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : view_agent . trash = True view_agent . save ( ) else : view_agent . delete ( ) return HttpResponseRedirect ( reverse ( 'services_agent_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'services_agent_view' , args = [ view_agent . id ] ) ) context = _get_default_context ( request ) context . update ( { 'view_agent' : view_agent } ) return render_to_response ( 'services/agent_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
agent delete .