首页 > 代码库 > 配置文件编辑和历史文件编辑代码
配置文件编辑和历史文件编辑代码
python代码
def nginxbj(request): id1 = request.GET[‘id‘] host_list = get_object_or_404(NginxET, pk=id1) form = HostsListForm(instance=host_list) action=‘edit‘ page_name="编辑配置文件" ret = NginxET.objects.values_list(‘message‘, flat=True).get(id=id1) return render_to_response(‘nginxbianji.html‘, {‘ret‘: ret, ‘id1‘: id1},context_instance=RequestContext(request)) def nginxbjh(request): id1 = request.GET[‘id‘] host_list = get_object_or_404(NginxEThistory, pk=id1) form = HostsListForm(instance=host_list) action=‘edit‘ page_name="编辑配置文件" ret = NginxEThistory.objects.values_list(‘message‘, flat=True).get(id=id1) return render_to_response(‘nginxbianji.html‘, {‘ret‘: ret, ‘id1‘: id1},context_instance=RequestContext(request))
html代码
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <!-- Favicon --> <link rel="shortcut icon" href="http://www.mamicode.com/static/img/favicon.ico" type="image/x-icon"> <!-- Bootstrap core CSS --> <link rel="stylesheet" href="http://www.mamicode.com/static/plugins/bootstrap/css/bootstrap.min.css"> <!-- Fonts from Font Awsome --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/font-awesome.min.css"> <!-- CSS Animate --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/animate.css"> <!-- Custom styles for this theme --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/main.css"> <meta name="robots" content="all" /> <meta name="author" content="w3school.com.cn" /> <link rel="stylesheet" type="text/css" href="http://www.mamicode.com/tiy/tc.css" /> <title>W3School在线测试工具 V2</title> </head> <body id="editor"> <div id="wrapper"> <div id="ad"> <script type="text/javascript"><!-- google_ad_client = "pub-3381531532877742"; /* 728x90, tiy_big */ google_ad_slot = "7947784850"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <form action="http://:8999/nginxhistory/?abc={{ id1 }}" method="post" id="tryitform" name="tryitform" onSubmit="validateForm();" target="i"> <div id="butt"> <input type="button" value="http://www.mamicode.com/提交代码" onClick="submitTryit()"> </div> <div id="CodeArea" style=" height: 800px; width: 900px; "> <h2>编辑您的代码:</h2> <textarea id="TestCode" cols="160" rows="50" wrap="logical" > {{ ret }} </textarea> </div> <input type="hidden" id="code" name="code" /> <input type="hidden" id="bt" name="bt" /> </form> <script type="text/javascript"> function submitTryit() { var t=document.getElementById("TestCode").value; //t=t.replace(/=/gi,"w3equalsign"); //t=t.replace(/script/gi,"w3scrw3ipttag"); document.getElementById("code").value=http://www.mamicode.com/t;"tryitform").action="http://:8999/nginxhistory/"; document.getElementById("TestCode").action="http://:8999/nginxhistory/?abc={{ id1 }}"; validateForm(); document.getElementById("tryitform").submit(); } function validateForm() { var code=document.getElementById("code").value; if (code.length>100000) { document.getElementById("code").value="http://www.mamicode.com/Error
"; } } </script> </body> </html>
nginxbjh.html
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <!-- Favicon --> <link rel="shortcut icon" href="http://www.mamicode.com/static/img/favicon.ico" type="image/x-icon"> <!-- Bootstrap core CSS --> <link rel="stylesheet" href="http://www.mamicode.com/static/plugins/bootstrap/css/bootstrap.min.css"> <!-- Fonts from Font Awsome --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/font-awesome.min.css"> <!-- CSS Animate --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/animate.css"> <!-- Custom styles for this theme --> <link rel="stylesheet" href="http://www.mamicode.com/static/css/main.css"> <meta name="robots" content="all" /> <meta name="author" content="w3school.com.cn" /> <link rel="stylesheet" type="text/css" href="http://www.mamicode.com/tiy/tc.css" /> <title>W3School在线测试工具 V2</title> </head> <body id="editor"> <div id="wrapper"> <div id="ad"> <script type="text/javascript"><!-- google_ad_client = "pub-3381531532877742"; /* 728x90, tiy_big */ google_ad_slot = "7947784850"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <form action="http://:8999/nginxhistory/?abc={{ id1 }}" method="post" id="tryitform" name="tryitform" onSubmit="validateForm();" target="i"> <div id="butt"> <input type="button" value="http://www.mamicode.com/提交代码" onClick="submitTryit()"> </div> <div id="CodeArea" style=" height: 800px; width: 900px; "> <h2>编辑您的代码:</h2> <textarea id="TestCode" cols="160" rows="50" wrap="logical" > {{ ret }} </textarea> </div> <input type="hidden" id="code" name="code" /> <input type="hidden" id="bt" name="bt" /> </form> <script type="text/javascript"> function submitTryit() { var t=document.getElementById("TestCode").value; //t=t.replace(/=/gi,"w3equalsign"); //t=t.replace(/script/gi,"w3scrw3ipttag"); document.getElementById("code").value=http://www.mamicode.com/t;"tryitform").action="http://:8999/nginxhistory/"; document.getElementById("TestCode").action="http://:8999/nginxhistory/?abc={{ id1 }}"; validateForm(); document.getElementById("tryitform").submit(); } function validateForm() { var code=document.getElementById("code").value; if (code.length>100000) { document.getElementById("code").value="http://www.mamicode.com/Error
"; } } </script> </body> </html>
本文出自 “学习linux” 博客,请务必保留此出处http://10265013.blog.51cto.com/10255013/1910611
配置文件编辑和历史文件编辑代码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。