def get_classlist(self): lst = [] for cls in self.class_list.all() lst.append(str(cls)) return mark_safe('<br>'.join(lst))