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

Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.

This commit is contained in:
Peter Andersen
2019-12-09 08:54:40 -08:00
committed by Mariusz Felisiak
parent 3fb7c12158
commit 02eff7ef60
3 changed files with 17 additions and 3 deletions

View File

@@ -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):