1
0
mirror of https://github.com/django/django.git synced 2024-12-23 09:36:06 +00:00

Removed unnecessary empty dict creation in ChoiceWidget.create_option().

build_atttrs() already creates an empty dict if extra_attrs is None.
This commit is contained in:
David Smith 2021-01-19 05:52:34 +00:00 committed by GitHub
parent 34aa4f1997
commit 6b01511f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -620,8 +620,6 @@ class ChoiceWidget(Widget):
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
index = str(index) if subindex is None else "%s_%s" % (index, subindex)
if attrs is None:
attrs = {}
option_attrs = self.build_attrs(self.attrs, attrs) if self.option_inherits_attrs else {}
if selected:
option_attrs.update(self.checked_attribute)