def update_parameter(request):
if request.method == 'GET':
from urllib import unquote
update_parameter_form = StepManipulateForm(request.GET)
if update_parameter_form.is_valid():
cd = update_parameter_form.cleaned_data
step = Protocol.objects.get(id=cd['id'])
if (step.check_owner(request.user.id) or request.user.is_superuser):
step.update_parameter(unquote(cd['parameter']))
step.save()
return success('Your step has been updated.')
else:
return error('Your are not owner of the step.')
else:
return error(str(update_parameter_form.errors))
else:
return error('Method error')
评论列表
文章目录