简体   繁体   中英

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

my HTML code

<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 code

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

Let me know if I'm missing something

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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