def set_auto_approve_original(request):
    profile = UserProfile.get_or_create_profile(request.user)
    if (not profile.is_net_admin):
        return HttpResponseRedirect("/dashboard")
    
    script_proxies = AutoApproveServerProxy.objects.filter(admin=request.user)
    if len(script_proxies)>0:
        script_proxy = script_proxies[0]
    else:
        script_proxy = AutoApproveServerProxy.objects.create(admin=request.user)
    
    script = AdminAutoApproveScript.objects.get_or_create(admin=request.user)[0]

    # prepare a list of script options to be set
    user_script_options = ["Manual"]
    user_script_options = user_script_options + AUTO_APPROVAL_MODULES.keys()
    user_script_options.append("Remote")
    
    error_msg = []
    if (request.method == "POST"):
        if request.POST["script"] not in user_script_options:
            error_msg.append("Invalid script name %s"%request.POST["script"])
        elif request.POST["script"] == "Remote":
            form = ScriptProxyForm(request.POST,instance=script_proxy)
            if form.is_valid():
                script.remote = True
                script.script_name = request.POST["script"]
                logger.debug("Form is valid")
                script_proxy = form.save()
                script.save()
                return HttpResponseRedirect(reverse("dashboard"))

        else:
            form = ScriptProxyForm(instance=script_proxy)
            script.remote = False
            script.script_name = request.POST["script"]
            script.save()
            return HttpResponseRedirect(reverse("dashboard"))
        
    else:
        form = ScriptProxyForm(instance=script_proxy)
    

    return simple.direct_to_template(request, 
            template = "openflow/optin_manager/admin_manager/set_auto_approve.html",
            extra_context = {
                    'user_script_options':user_script_options,
                    'error_msg':error_msg,
                    'form':form,
                    'current_script':script.script_name,
               },
        )
The view function for setting  user flowspace request auto approval script.
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/optin_manager/admin_manager/views.py/set_auto_approve_original