Improved performance of django.forms.ChoiceWidget.optgroups().

This commit is contained in:
David Smith 2021-01-27 20:10:11 +00:00 committed by GitHub
parent 8a642b88c3
commit 54102d20b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -606,8 +606,8 @@ class ChoiceWidget(Widget):
for subvalue, sublabel in choices:
selected = (
str(subvalue) in value and
(not has_selected or self.allow_multiple_selected)
(not has_selected or self.allow_multiple_selected) and
str(subvalue) in value
)
has_selected |= selected
subgroup.append(self.create_option(