django display m2m elements in a template

Posted by dana on Stack Overflow See other posts from Stack Overflow or by dana
Published on 2010-06-17T20:26:20Z Indexed on 2010/06/17 20:43 UTC
Read the original article Hit count: 182

Filed under:
|
|

if a have a declaration like

         theclass = Classroom.objects.get(classname = classname)
         members = theclass.members.all()

and i want to display all the members(of a class) in a template, how should i do it??

if i write:

{{theclass.members.all}}

the output is an empty list(though the class has some members)

How should the elements of a m2m table be displayed in a template? thanks!

© Stack Overflow or respective owner

Related posts about django

Related posts about template