码迷,mamicode.com
首页 > 编程语言 > 详细

【Web】Javascript、Python、Django模板配合处理URL Encode

时间:2016-05-14 10:13:35      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:

1、JS

function relaunch(id, service, submit) {
            var username = $("#id_username").text();
            /* if (submit != username && submit != "null") {
                addAlert("Warning: " + "Permission Denied, Only Your Private Deploy Allowed To Relaunch !");
                return false;
            } */
            window.location = /deployNext/?type=redo&deploy_id=+id+&service=+encodeURI(service);
        }

2、Python

>>> from urllib import quote
>>> quote(魔兽)
%C4%A7%CA%DE

3、Django模板

<ul class="dropdown-menu">
                                            <!-- <li><a href="/newJobBasic/">Basic</a></li>
                                            <li><a href="/newJobScript/">Script</a></li>
                                            <li><a href="/newJobPlaybook/">Playbook</a></li> -->
                                                {% for item in tmp_keys %}
                                                    <li><a href="/deployNext/?type=new&service={{item | urlencode}}">{{item}}</a></li>
                                                {% endfor %}
                                        </ul>

 

参考资料:

python中的urlencode与urldecode :http://blog.csdn.net/haoni123321/article/details/15814111

 

【Web】Javascript、Python、Django模板配合处理URL Encode

标签:

原文地址:http://www.cnblogs.com/junneyang/p/5491987.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!