@handle_response_format
@treeio_login_required
def sla_edit(request, sla_id, response_format='html'):
 sla = get_object_or_404(ServiceLevelAgreement, pk=sla_id)
 if (not request.user.profile.has_permission(sla, mode='w')):
  return user_denied(request, message="You don't have access to this Service Level Agreement")
 if request.POST:
  if ('cancel' not in request.POST):
   form = ServiceLevelAgreementForm(request.user.profile, request.POST, instance=sla)
   if form.is_valid():
    sla = form.save()
    return HttpResponseRedirect(reverse('services_sla_view', args=[sla.id]))
  else:
   return HttpResponseRedirect(reverse('services_sla_view', args=[sla.id]))
 else:
  form = ServiceLevelAgreementForm(request.user.profile, instance=sla)
 context = _get_default_context(request)
 context.update({'sla': sla, 'form': form})
 return render_to_response('services/sla_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def sla_edit ( request , sla_id , response_format = 'html' ) : sla = get_object_or_404 ( ServiceLevelAgreement , pk = sla_id ) if ( not request . user . profile . has_permission ( sla , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Service Level Agreement" ) if request . POST : if ( 'cancel' not in request . POST ) : form = ServiceLevelAgreementForm ( request . user . profile , request . POST , instance = sla ) if form . is_valid ( ) : sla = form . save ( ) return HttpResponseRedirect ( reverse ( 'services_sla_view' , args = [ sla . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'services_sla_view' , args = [ sla . id ] ) ) else : form = ServiceLevelAgreementForm ( request . user . profile , instance = sla ) context = _get_default_context ( request ) context . update ( { 'sla' : sla , 'form' : form } ) return render_to_response ( 'services/sla_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
servicelevelagreement edit .