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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:31:50+00:00 2026-05-26T02:31:50+00:00

I have a form field like so IS_EMPLOYED_CHOICES = ( (‘1’, ‘yes’), (‘0’, ‘no’)

  • 0

I have a form field like so

IS_EMPLOYED_CHOICES = (
    ('1', 'yes'), ('0', 'no')
    )
class AddEmployee(forms.Form):
    is_employed = forms.ChoiceField(choices=IS_EMPLOYED_CHOICES)

and the field in the model is a BooleanField

is_employed = models.BooleanField()

I am aware that a BooleanField is a varchar with either a '1' or '0' for True or False

However I want to pass this value from the model to the form field above so it would show no when it is False and yes when it is true.

 emp_profile = Employees.objects.get(pk=1)
 emp_form = AddEmployee(initial={
      'is_employed' = emp_profile.is_employed
 })

does not work

  • 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-26T02:31:50+00:00Added an answer on May 26, 2026 at 2:31 am

    When the value actually comes out, it’s True and False instead of '1' and '0'.

    So you would do something like

    IS_EMPLOYED_CHOICES = (
        (True, 'yes'), (False, 'no')
        )
    

    and it should work

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

Sidebar

Related Questions

I have a form like this: class MyForm(forms.Form): [...] which is rendered in my
I have form like this : <div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div> <div id='remove_field' class='locbutton2'><a
I have a form with input field which can be accessed like var algorithm
I have JavaScript form validation functions like so: function validate_name(field) { if (field ==
I have a form field: web_address = forms.RegexField(regex=r'^DO SOMETHING$', error_messages = {'invalid': _(Not a
I have a form like this: CHOICES = [ ('a', 'a_value'), ('b', 'b_value'), ('c',
I have a form field in my Rails app with a placeholder. I'd like
I would like to have the form object like this: public class FormData {
I have created a form field like so: <p> <label for=your-name style=display: block; >Your
The case: I have a form class which handles HTML forms, cleans up fields

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.