summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/forms/widgets.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index ba8346ac97..1976c201a9 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -522,9 +522,7 @@ class CheckboxInput(Input):
def get_context(self, name, value, attrs):
if self.check_test(value):
- if attrs is None:
- attrs = {}
- attrs['checked'] = True
+ attrs = {**(attrs or {}), 'checked': True}
return super().get_context(name, value, attrs)
def value_from_datadict(self, data, files, name):