@treeio_login_required
@handle_response_format
def service_record_edit(request, service_record_id, response_format='html'):
 service_record = get_object_or_404(ItemServicing, pk=service_record_id)
 if (not request.user.profile.has_permission(service_record, mode='w')):
  return user_denied(request, message="You don't have write access to this ServiceRecord", response_format=response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = ServiceRecordForm(request.user.profile, None, request.POST, instance=service_record)
   if form.is_valid():
    service_record = form.save(request)
    return HttpResponseRedirect(reverse('infrastructure_service_record_view', args=[service_record.id]))
  else:
   return HttpResponseRedirect(reverse('infrastructure_service_record_view', args=[service_record.id]))
 else:
  form = ServiceRecordForm(request.user.profile, None, instance=service_record)
 context = _get_default_context(request)
 context.update({'service_record': service_record, 'form': form})
 return render_to_response('infrastructure/service_record_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def service_record_edit ( request , service_record_id , response_format = 'html' ) : service_record = get_object_or_404 ( ItemServicing , pk = service_record_id ) if ( not request . user . profile . has_permission ( service_record , mode = 'w' ) ) : return user_denied ( request , message = "You don't have write access to this ServiceRecord" , response_format = response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = ServiceRecordForm ( request . user . profile , None , request . POST , instance = service_record ) if form . is_valid ( ) : service_record = form . save ( request ) return HttpResponseRedirect ( reverse ( 'infrastructure_service_record_view' , args = [ service_record . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'infrastructure_service_record_view' , args = [ service_record . id ] ) ) else : form = ServiceRecordForm ( request . user . profile , None , instance = service_record ) context = _get_default_context ( request ) context . update ( { 'service_record' : service_record , 'form' : form } ) return render_to_response ( 'infrastructure/service_record_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
servicerecord edit page .