0
 <tbody>
        {% for j in dat %}
        <tr>
            {%for h in hed %}
            <td>{{j.h}}</td>
            {% endfor %}
        </tr>
        {% endfor %}
    </tbody>

want to get value by object.field_name from the model. I've tried {{ j }}.{{ h }} but it does not return the value instead returns obj1.field_name. Any possible method i should try.

Venki WAR
  • 1,997
  • 4
  • 25
  • 38
p.ry
  • 409
  • 1
  • 8
  • 21
  • 2
    Possible duplicate of [Performing a getattr() style lookup in a django template](https://stackoverflow.com/questions/844746/performing-a-getattr-style-lookup-in-a-django-template) – awesoon May 04 '18 at 11:22
  • tried the getattribute() template tag and it returned AttributeError: 'Settings' object has no attribute 'TEMPLATE_STRING_IF_INVALID'. Should i alter the settings.py file? – p.ry May 07 '18 at 08:49
  • You can replace `TEMPLATE_STRING_IF_INVALID` with any sting you want. It does not matter in your case – awesoon May 07 '18 at 08:51
  • Thanks to you , worked finally! – p.ry May 07 '18 at 09:07

0 Answers0