I have models like : class Record(models.Model): patient_id = models.IntegerField(primary_key=True) name = models.CharField(max_length=200) problem = models.CharField(max_length=500)
and class PatientHistory(models.Model): patient = models.ForeignKey(Record) date = models.DateField(auto_now_add=True) analysis = models.CharField(max_length=200) prescription = models.CharField(max_length=500) The data in database is also: Record Table: patient_id name problem 1 deepak headache PatientHistory table: id patient_id date analysis prescription 1 1 2010-07-25 infection antibiotic 2 1 2010-07-25 infection antibiotic in my views.py def patientdetails(request, patient_id): err = "Successfull" p = PatientHistory.objects.filter(id__exact=1) return render_to_response('patientdetails.html', {'patient': p}) In TEMPLATE file, I am trying to print the data: Details {{patient.date}},, {% if patient.patient.patient_id %} {{patient.patient.patient_id }}, {{patient.patient.name}}, {{patient.patient.problem}} {% else %} No Records! {%endif %} I am getting Details ,, No Records! PLEASE HELP ME! I M STUCK AT THIS POINT!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.