Q: display templates value in datatable (django) t = Template(" my name is {{ my_name }}")
c = Context({ "my_name": patient.name })
//(like patient.age,patient.height.......... i want to display 8 fields of form in my datatable.)
d = t.render(c)

I want to display the template value in datatable. Here is my HTML code, where I'm trying but could getting exactly. Please help.
    {% for patient in PatientInfo %}

            <tr><td>{{patient.name }}</td>
                        <td>{{patient.uhid }}</td>
            <td>{{patient.age }}</td>
            <td>{{patient.gender }}</td>
            <td>{{patient.height }}</td>
            <td>{{patient.weight }}</td>
            <td>{{patient.address }}</td>
            <td>{{patient.phone_number }}</td></tr>



    {% endfor %}


A: Seems that you are trying to iterate PatientInfo which is probably a class defined in your models.py. It would make more sense here to provide Patient object itself as a context item.
Instead of c = Context({ "my_name": patient.name }), you would use c = Context({ "patient": patient })
Now in your template, you can access the attributes of the patient by {{ patient.age }} , for example. The for loop is only required when you are iterating over QuerySet, not a single item.
