On Jul 24, 9:19 pm, deepak dhananjaya <[email protected]>
wrote:
> I am passing PatientHistory type class object to template
> PatientHistory has patient which is of type record.
> so inturn when I receive PatientHistory as parameter to template, i.e.
> patient, it inturn has patient.patient.patient_id
>
> but even after ignoring patient_id,
> {{patient.date}} is also not getting displayed.
>
> so wondering how to get the details..
>
You are calling .filter() here:
p = PatientHistory.objects.filter(id__exact=1)
so you will be getting a queryset, ie a collection of PatientHistory
objects, even though there is only one matching record. You need to
either iterate through the list in your template, slice with [0] in
the view, or (preferably) use .get() instead of .filter().
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.