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 190631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:16:22+00:00 2026-05-11T16:16:22+00:00

How do I get the choices field values and not the key from the

  • 0

How do I get the choices field values and not the key from the form?

I have a form where I let the user select some user’s emails for a company.
For example I have a form like this (this reason for model form is that it’s inside a formset – but that is not important for now):

class Contacts(forms.ModelForm):
   def __init__(self, *args, **kwargs):
        super(Contacts, self).__init__(*args, **kwargs)
        self.company = kwargs['initial']['company']
        self.fields['emails'].choices = self.company.emails
        # This produces stuff like:
        # [(1, 'email@email.com'), ...]

   emails = forms.MultipleChoiceField(required=False)

    class Meta:
        model = Company

and I want to get the list of all selected emails in the view, something like this:

  form = ContactsForm(request.POST)
  if form.is_valid():
       form.cleaned_data['emails'][0] # produces 1 and not email

There is no get_emails_display() kind of method, like in the model for example. Also, a suggestion form.fields['emails'].choices does not work, as it gives ALL the choices, whereas I need something like form.fields['emails'].selected_choices?

Any ideas, or let me know if it’s unclear.

  • 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-11T16:16:22+00:00Added an answer on May 11, 2026 at 4:16 pm

    It might not be a beautiful solution, but I would imagine that the display names are all still available from form.fields['emails'].choices so you can loop through form.cleaned_data['emails'] and get the choice name from the field’s choices.

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

Sidebar

Related Questions

I have some models and I want to generate a multi-selection form from this
I have a django form that allows a user to select multiple options: CARDS
I am getting the values from checkbox field from django custom form as shown
I have a pretty simple form with some fields from a doctrine model. $this->widgetSchema['fields']
Is there any get() function for this instead? {% for key, value in choices.items
I have a form (that consists of 25+ fields) and the values for these
I have an Event model with a finish_time field and a form checkbox called
How can I get the values of a dynamic choice field and save them
How do you get a MultipleChoiceField() to correctly load initial values? I have a
I have a model with field: class Movie(models.Model): genre = models.CommaSeparatedIntegerField(max_length=100, choices=GENRE_CHOICES, blank=True, default=0)

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.