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

197
Views
Django forms validating boolean values and numbers as string

I have a form as shown below,

class UserForm(forms.ModelForm):
    name = forms.CharField(max_length=255)
    tagline = forms.CharField(max_length=255)
    privacy = forms.CharField(max_length=10)
    description = forms.CharField(max_length=2000)
    home_id = forms.CharField(max_length=32, required=False)

    class Meta:
        model = User
        fields = ['name', 'tagline', 'privacy', 'description']

and when I pass any field as a boolean or numerical value (say, name=True) , the form validates it form.is_valid returns True while if I skip one field (say name=None), the form says the form is invalid. The form works, but not for a boolean value for any field.

Form also validates correctly for floats, lists and dicts. What am I doing wrong? The same happens for a form.Form without mentioning a model.

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!