Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7172625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:39:13+00:00 2026-05-28T15:39:13+00:00

I have a ModelForm with a ModelMultipleChoiceField. users = forms.ModelMultipleChoiceField( widget=forms.SelectMultiple(attrs={‘class’: ‘chzn-select’}), queryset =

  • 0

I have a ModelForm with a ModelMultipleChoiceField.

users = forms.ModelMultipleChoiceField(
  widget=forms.SelectMultiple(attrs={'class': 'chzn-select'}),
   queryset = User.objects.filter(...))

My list is displayed by username, as the default repr method of the model.

I want to display the first_name and the last_name without overloading the repr method, because I need username in other cases.

I wouldn’t like to get the values_list('id', 'first_name', 'last_name'), because later I don’t get a model list on save() but tuples.

Is there any setting/hack for this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:39:14+00:00Added an answer on May 28, 2026 at 3:39 pm

    You can alter the object representation by overriding label_from_instance, which is part of the ModelChoiceField class that ModelMultipleChoiceField inherits.

    https://docs.djangoproject.com/en/1.3/ref/forms/fields/#django.forms.ModelChoiceField

    https://docs.djangoproject.com/en/1.3/ref/forms/fields/#modelmultiplechoicefield

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this: class HouseForm(forms.ModelForm): amenities = ModelMultipleChoiceField( queryset=Amenity.objects.all(), widget=forms.CheckboxSelectMultiple(), required=False ) Is there
I have form: class ItemForm(forms.ModelForm): id = forms.ModelChoiceField(queryset=Item.objects.all(), widget=forms.HiddenInput()) temp = forms.BooleanField(widget=forms.HiddenInput(), required=False) date
I have form: class AdmItemForm(forms.ModelForm): id = forms.ModelChoiceField(queryset=Article.objects.all(), widget=forms.HiddenInput()) mainimage = forms.ImageField(widget=AdmImageWidget(), required=False) tags
I have form: class Form(forms.ModelForm): id = forms.ModelChoiceField(queryset=Category.objects.all(), widget=forms.HiddenInput()) def choices(self): items = ...query
I have a ModelForm as follows: class ArticleForm(forms.ModelForm): title = forms.CharField(max_length=200) body = forms.CharField(widget=forms.Textarea)
I have the following form: class FeaturedVideoForm(ModelForm): featured_video = forms.ModelChoiceField(Video.objects.none() widget=make_select_default, required=False, empty_label='No Featured
I have the following form: class ModuleItemForm2(forms.ModelForm): class Meta: model = Module_item fields =
I Have this Form class MyModelForm(forms.ModelForm): boolfield = forms.TypedChoiceField(coerce=bool, choices=((False, 'No'), (True, 'Yes')), widget=forms.RadioSelect
I have a form class that looks like this: class ApplicationDetailsForm(ModelForm): worked_in_industry = forms.TypedChoiceField(coerce=int,
I have in my models.py class Business(models.Model): industry = models.models.ManyToManyField(Industry) in forms.py class BusinessForm(forms.ModelForm):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.