Opened 6 years ago

Closed 6 years ago

Last modified 4 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: UI/UX:


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 Changed 6 years ago by thiggins

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.1 to 1.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 Changed 6 years ago by ramiro

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12667.

comment:3 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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