簡體   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