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

236
Views
Django form widgets and the choice is not one of available choices

I'm trying to change the default value of the "true / false" checkboxes to another.

Unfortunately. I receive a form error: “the choice is not one of available choices”.

Please tell me what have I done wrong?

models.py

CHECKBOX_CHOICES = (('1', 'The first choice'), ('2', 'The Second Choice'))

class Order(models.Model):
        paid = models.CharField(max_length=350, choices=CHECKBOX_CHOICES)

forms.py

from django import forms
from .models import Order

class OrderCreateForm(forms.ModelForm):
    class Meta:
        model = Order
        fields = ['paid']
 widgets = {
            'paid': forms.CheckboxSelectMultiple()
        }

If I change forms.CheckboxSelectMultiple() to forms.CheckboxInput() I receive a form error:

Select the correct value. True is not one of the choices available.

create.html

  <form action="." method="post" class="order-form">
    {{ form.as_ul }}
    <p><input type="submit" value="Submit"></p>
    {% csrf_token %}
  </form>

rendered html

<ul id="id_paid">
    <li><label for="id_paid_0"><input type="checkbox" name="paid" value="" checked="" id="id_paid_0">
 ---------</label>
</li>
    <li><label for="id_paid_1"><input type="checkbox" name="paid" value="1" id="id_paid_1">
 The first choice</label>
</li>
    <li><label for="id_paid_2"><input type="checkbox" name="paid" value="2" id="id_paid_2">
 The Second Choice</label>
</li>
</ul>

It's important to me, even though it's a little thing.

over 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!