![](/img/trans.png)
[英]How do I take a variable from views.py in Django and display it on my HTML page
[英]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.