Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

520
Views
Django CheckboxSelectMultiple() widget - Form widget value not selected after saving data options

How to can I work with multiple select options and make these options selected to stay selected ?

Some application? Should I use any JS?

Is possible that my approach may be incomplete or miss something ...?

Context

I have the following model:

class AcademicPeople(models.Model):

    CATHEDRAL_PROFESSOR = 'CATHEDRAL'
    RESEARCH_PROFESSOR = 'RESEARCH'
    INSTITUTIONAL_DIRECTIVE = 'DIRECTIVE'

    OCCUPATION_CHOICES = (
        (CATHEDRAL_PROFESSOR, 'Cathedral Professor'),
        (RESEARCH_PROFESSOR, 'Research Professor'),
        (INSTITUTIONAL_DIRECTIVE, 'Institutional Directive'),
    )

    occupation = models.CharField(
        max_length=255,
        blank = False,
    )

In the forms.py I have:

from .models import
from django.forms.widgets import CheckboxSelectMultiple

class AcademicPeopleForm(forms.ModelForm):
    title = "Details"
    occupation = forms.MultipleChoiceField(
        required=False,
        label='Occupation',
        widget=CheckboxSelectMultiple(),
        choices=AcademicPeople.OCCUPATION_CHOICES
    )

    class Meta:
        model = AcademicPeople
        fields = ('occupation',)

UPDATE

My view is very basic, is the following:

class AccountSettingsUpdateView(LoginRequiredMixin, UpdateView):
    model = AcademicPeople
    form_class = AcademicPeopleForm
    success_url = reverse_lazy('dashboard')
    context_object_name = 'preferences'

When I go to my template using the browser, I get the checkbox select multiple rendered in checkboxes, I select some options and when I save, these options selected does not show their value.

enter image description here

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!