0
votes

below is code

in the views.py

def detail(request): ...... v_context={ "data":df.to_dict('records'), } return render(request,'detail.html',context=v_context)

in the template

{% for i  in data%}
<table style="width:100%">
<tr>
    <th>date</th>
    <th>close</th> 

  </tr>
  <tr>
    <td>{{i.date}}</td>
    <td>{{i.close}}</td> 

  </tr>
</table>
{%endfor %}

================ end code===

Just wonder why in template, not using i['data'] or i['close'].

Thanks

1

1 Answers

0
votes

Template language in Django is Jinja and you access all the data passed from view to template in this Jinja way {{i.date}}. See also your for loop. It's Jinja again not pure python.