小编Eze*_*iel的帖子

使用标签或 href 传递 Django 数据

我有一个包含链接的表,我想在单击链接以执行更多操作时将一些数据传递给我的函数。

***my.html***

<table>
 <tbody>
 {% for query in queries %}
  <tr>
   <td name="my_data" value="{{query.name}}"><a href="/internal/my_func">{{query.name}}</a>
  </tr>
 {% endfor %}
 </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

这是我的网址

***urls.py***

from django.conf.urls import url, patterns
from app.views import *

urlpatterns = patterns('',
  url(r'^internal/my_func$', my_func),
)
Run Code Online (Sandbox Code Playgroud)

我的观点

***views.py***

def my_func(request):
 # how do i get the query.name value here for me to perform more actions on it
 query = request.Get.get('my_data')

 # this does not work
Run Code Online (Sandbox Code Playgroud)

python django

3
推荐指数
1
解决办法
3585
查看次数

clojure字母数字排序

我可以使用排序对字母或数字进行排序,但如何对字母和数字进行排序.

(sort ["f" "g" "a" "b" "c"]) ; ==> ("a" "b" "c" "f" "g")

(sort [3 4 6 1 8 ])  ; ==> (1 3 4 6 8)
Run Code Online (Sandbox Code Playgroud)

问题是,我该如何排序?["g" "a" "c" 4 6 1]要得到(1 4 6 "a" "c" "g")

sorting clojure

2
推荐指数
1
解决办法
656
查看次数

标签 统计

clojure ×1

django ×1

python ×1

sorting ×1