I have a model:
class SchedulerProfile(models.Model):
user = models.ForeignKey(User, unique=True)
first_name = models.CharField(max_length=50)
la
Subclass ModelMultipleChoiceField and override label_from_instance
.
from django.forms import ModelMultipleChoiceField
class SchedulerProfileChoiceField(ModelMultipleChoiceField):
def label_from_instance(self, obj):
return "%s %s" % (obj.first_name, obj.last_name)
Then use your multiple choice field in the model form.
class OfficialProfileForm(forms.ModelForm):
schedulers = SchedulerProfileChoiceField(queryset=SchedulerProfile.objects.all())