#4653: form_for_instance generates empty choice for non-blank CharField with
options
------------------------------------------------------------------------+---
   Reporter:  Ilya Semenov <[EMAIL PROTECTED]>                         |        
        Owner:  adrian                
     Status:  new                                                       |       
     Component:  django.newforms       
    Version:  SVN                                                       |       
    Resolution:                        
   Keywords:  form_for_instance form_for_model CharField options blank  |       
         Stage:  Design decision needed
  Has_patch:  1                                                         |       
    Needs_docs:  0                     
Needs_tests:  0                                                         |   
Needs_better_patch:  1                     
------------------------------------------------------------------------+---
Changes (by mrmachine):

 * cc: [EMAIL PROTECTED] (added)

Comment:

 I'm a strong -1 for this. Select fields should *always* have an empty
 option ('--------') unless the field is required *and* an explicit default
 value has been defined. The purpose of the empty option is to force users
 to make a selection by not providing an implicit default.
 
 In the second case, oldforms used to show an empty option if the field was
 either not required, or was required but didn't have a default option. If
 newforms no longer works  that way, we should fix that bug.
 
 Assuming we reverted to the oldforms behaviour, a 'none of the above'
 option could be specified as ('none', '-- none of the above --') in your
 choices list. This wouldn't negate the need to force the user to make an
 actual selection, but if you want to remove the empty option and make
 'none of the above' the default, just make your field required and set
 'none' as the default.
 
 Regarding the example of the 'Component:' selector in trac, this makes
 sense because an explicit default of 'Uncategorized' is defined.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4653#comment:5>
Django Code <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