如果有一个像这样的声明
def inside_classroom(request,classname):
theclass = Classroom.objects.get(classname = classname)
members = theclass.members.all()
c = Courses.objects.filter(classroom = theclass)
return render_to_response('classroom/inside_classroom.html', {
'theclass': theclass,
'c':c,
'members':members,
},
context_instance=RequestContext(request))
我想在模板中显示所有成员(一个类),我应该怎么做?
如果我写:
{{theclass.members.all}}
输出是一个空列表(尽管该类有一些成员)
m2m表格的元素应该如何在模板中显示?谢谢!