Get Episode 1 Episode 2 Episodes 3 Episodes 4 of tv series Story No 1 Watch all.We the group are linked up with a big so we decided to make a 3 part web series as a teaser to the upcoming feature film. which we have planned to release this year. We have a lot of plans in store for the future of HTG. But this web series we are bringing it out which is more like a teaser to the upcoming feature film.We are also inviting you to join HTG’s new IRC Channel at http:; Join us at #httchataq. You can also join and discuss their plans on our HTG Forums.Q:
Django - How to extract a value from HTML in Template File
I am developing a web application in Django with Google App engine (Python version 2.7). I am using Django template language to generate the response.
I have an html template in views.py file with HTML structure shown below.
{% for q in questions %}
{% for row in q %}
{{ row.question }}
{{ row.selected_answer }}
{{ row.guess }}
{{ row.actual }}
{{ row.difference }}
{{ row.correct }}
{% endfor %}
As can be seen from the above code, I am looping through questions for which I get all the questions and then looping through every question for every row. This is the way I am getting the current row.
From the template, I want to extract value of the td tags.
How can I extract a value of the td tags from the template file?
A:
Your code is mixing up the template and the logic. You should only put the HTML inside the templates. The following should work:
views.py
def results(request):
...
return render_to_response('mytemplate.html', {
'questions': questions,
'rows': q
Related links:
Comments