#12722: Models having selects with optgroups per Ticket #4412 no longer validate
reliably
--------------------------------------------------+-------------------------
 Reporter:  thiggins                              |       Owner:  nobody    
   Status:  new                                   |   Milestone:  1.2       
Component:  Uncategorized                         |     Version:  1.1       
 Keywords:  model-validation, choices, optgroups  |       Stage:  Unreviewed
Has_patch:  0                                     |  
--------------------------------------------------+-------------------------
 Since Ticket #4412, nested choice structures have been permitted. This
 results in optgroups. The example that was given is reproduced here with
 one additional line:
 {{{
 choices = (
         ('outer1', 'Outer 1'),
         ('Group 1', (
                 ('inner1', 'Inner 1'),
                 ('inner2', 'Inner 2'),
                 ('outer1', 'Outer 1'),
             )
         )
     )
 }}}

 In the development version, currently (version 1.2 alpha 1 SVN-12314),
 nested choice structures such as this still generate valid HTML, but
 associated models fail to validate unless the selection is from the
 'outer' category, or happens to have the same value as a selection from
 the outer category (such as the line I added). Otherwise a default
 validation error message, such as 'Value u'inner1' is not a valid choice'
 is generated.

 Let me point out that, in order to generate the HTML shown in #4412,
 eliminating a blank choice, one must follow the usage given 11/07/07 by
 semenov in Ticket #4653
 using a combination of an explicit blank=False and a declared default
 value.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12722>
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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to