Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#12722 closed (duplicate)

Models having selects with optgroups per Ticket #4412 no longer validate reliably

Reported by: thiggins Owned by: nobody
Component: Uncategorized Version: 1.2-alpha
Severity: Keywords: model-validation, choices, optgroups
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (3)

comment:1 by thiggins, 14 years ago

Version: 1.11.2-alpha

Let me remark that this behavior was observed in connection with a model form, and correct the version to 1.2-alpha. Also, I have not checked for this problem in the Admin.

comment:2 by Ramiro Morales, 14 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12667.

comment:3 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top