首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将index.html页面的href id捕获到views.py文件中,并使用它在Django中呈现第二个html页面

如何将index.html页面的href id捕获到views.py文件中,并使用它在Django中呈现第二个html页面
EN

Stack Overflow用户
提问于 2014-09-02 20:22:24
回答 1查看 63关注 0票数 0

我的HTML代码

代码语言:javascript
复制
<html>
{% for d in name %}
<li><a id = {{d}} alt={{d|slugify }} href ="/hindi_guitarchords/{{d}}" 
class = "click">{{d}}</a> </li>
{% endfor %}
</html>

url.py代码

代码语言:javascript
复制
url(r'^hindi_guitarchords/(?P<d>.*)/$', 'guitarchordsapp.views.hindi_guitarchords'),

views.py

代码语言:javascript
复制
def hindi_guitarchords(request, d):
    msg = request.POST.get('d')
    #msg= get_object_or_404(Post,slug=d)

    return render_to_response('hindi_guitarchords.html',{'song_name':msg})

如果我错过了什么,请告诉我

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-03 06:36:41

msg = request.POST.get('d')替换为msg = d

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25631745

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档