django template value display -


possible duplicate:
display templates value in datatable (django)

actually i'm new django ur modified code.... follows: there 1 problem im facing when ever im trying save new entryies shows error exception value:
'queryset' object has no attribute 'save' , path_to_template dis m not getting bit confusion in dat...

actually in setting.py file did dis:

project_path = os.path.realpath(os.path.dirname(__file__)) template_dirs = (     project_path + '/templates/', ) 

your modified code:

class patientinfo(models.model): name = models.charfield(max_length=200)  uhid = models.charfield(max_length=200)  age = models.integerfield() gender = models.charfield(max_length=200) 

views.py:

def patient(request):   patients = patientinfo.objects.all()   t = template("path_to_template/mytemplate.html")   c = context({ "patients": patients })   d =     t.render(c)   return httpresponse(d) 

in mytemplate.html:

{% patient in patients %} {{patients.name }} {{patients.uhid }} {{patients.age }} {{patients.gender }} {%endfor%}

{% patient in patients %} <tr>  <td>{{patient_s_.name }}</td>  <td>{{patient_s_.uhid }}</td>  <td>{{patient_s_.age }}</td>  <td>{{patient_s_.gender }}</td> </tr> {%endfor%} 

first of should remove s @ end. calling .name .uhid etc within queryset instance, not in "patient" class. hope you.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -