开发者

Django urls on json request

开发者 https://www.devze.com 2022-12-28 23:55 出处:网络
When making a django request through json as, var info=id + \"##\" +name+\"##\" $.post(\"/supervise/activity/\" +开发者_开发技巧 info ,[] ,

When making a django request through json as,

 var info=id + "##" +name+"##"
 $.post("/supervise/activity/" +开发者_开发技巧 info ,[] ,
 function Handler(data,arr) 
  {

  } 

In urls.py

  (r'^activity/(?P<info>\d+)/$, 'activity'),

In views,

 def activity(request,info):
     print info

The request does not go through.info is a string.How can this be resolved

Thanks..


^activity/(?P<info>\d+)/$ will only match something like 'activity/42/' and the number (in this case 42) will be info.

If you appended '##name##' to the url, it will not be recognized.

0

精彩评论

暂无评论...
验证码 换一张
取 消