繁体   English   中英

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

[英]How do I capture the href id of my index.html page into my views.py file and use it to render my 2nd html page in Django

我的HTML代码

<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代码

url(r'^hindi_guitarchords/(?P<d>.*)/$', 'guitarchordsapp.views.hindi_guitarchords'),

views.py

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})

让我知道我是否想念一些东西

代替msg = request.POST.get('d')msg = d

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM