#2723: yes/no option for BooleanField
----------------------------------------------------------+-----------------
          Reporter:  Gary Wilson <[email protected]>  |         Owner:  
shanx                                   
            Status:  assigned                             |     Milestone:      
                                    
         Component:  django.contrib.admin                 |       Version:  SVN 
                                    
        Resolution:                                       |      Keywords:  
nfa-someday, sprintdec01, sprint-pycon08
             Stage:  Accepted                             |     Has_patch:  1   
                                    
        Needs_docs:  0                                    |   Needs_tests:  0   
                                    
Needs_better_patch:  1                                    |  
----------------------------------------------------------+-----------------
Comment (by tobias):

 Replying to [comment:16 beer]:
 > Where is difference between TypedChoiceField(coerce=bool,
 choices=((False, 'No'), (True, 'Yes')), widget=forms.RadioSelect) and
 this?

 That doesn't work because:

 {{{
 In [3]: bool('True')
 Out[3]: True

 In [4]: bool('False')
 Out[4]: True
 }}}

 And django will literally put str(True) ('True') and str(False) ('False')
 in your HTML.

 And if you use int as the coerce method, Django doesn't seem to properly
 convert the boolean value in the field to an into for display in the form.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2723#comment:17>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to