I returned the object itself in my configured MultipleModelChoiceField
from django.forms.models import ModelMultipleChoiceField
Class MyMultipleModelChoiceField (ModelMultipleChoiceField):
def label_from_instance(self, obj): return obj
I have in the template
<table> {% for checkbox in form.MyField %} <tr> <td> {{ checkbox.tag }} </td> <td> {{ checkbox.choice_label.field1 }} </td> <td> {{ checkbox.choice_label.field2}} </td> </tr> {% endfor %} </table>
Field1 and field2 are the fields of the object returned from label_from_instance. These programs display all selections in a table, where each line represents an object / record with a checkbox.
source share