1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #28996 -- Simplified some boolean constructs and removed trivial continue statements.

This commit is contained in:
Дилян Палаузов
2018-01-12 09:05:16 -05:00
committed by Tim Graham
parent 4bcec02368
commit a38ae914d8
34 changed files with 95 additions and 159 deletions

View File

@@ -587,9 +587,8 @@ class BaseModelFormSet(BaseFormSet):
return field.to_python
def _construct_form(self, i, **kwargs):
pk_required = False
if i < self.initial_form_count():
pk_required = True
pk_required = i < self.initial_form_count()
if pk_required:
if self.is_bound:
pk_key = '%s-%s' % (self.add_prefix(i), self.model._meta.pk.name)
try:

View File

@@ -599,8 +599,7 @@ class ChoiceWidget(Widget):
str(subvalue) in value and
(not has_selected or self.allow_multiple_selected)
)
if selected and not has_selected:
has_selected = True
has_selected |= selected
subgroup.append(self.create_option(
name, subvalue, sublabel, selected, index,
subindex=subindex, attrs=attrs,