How to write a Django view to obtain CharFields of multiple Django models that can only be accessed through relations?

You just need to fetch all EducationalQualification objects for certain student with all their relation objects.

You just need to fetch all EducationalQualification objects for certain student with all their relation objects: def view_qualifications(request, student_id): qs = EducationalQualification.objects. Filter(student__pk=student_id). \ select_related("student", "examination", "subject") # ... And then in template just iterate throught it: {% for q in qs %} {{q.student.Name}} {{q.examination.

Short_name}} {{q.subject. Short_name}} {{q. Institution}} {{q.

From_date}} {{q. To_date}} {{q. Marks}} {% endfor %}.

Works perfectly! I was thinking this wouldn't work because I had null=True for the subject ForeignKey. But it works exactly like it should.

You could even say RTFM I guess :) Thanks. – chefsmart Mar 24 '09 at 10:12 If you a a student object you can reference it the other way too. Student.

Educationqualification_set.all() will get you the same thing. – dalore Mar 10 '10 at 12:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions