diff options
| author | Peter Andersen <peter@porksmash.com> | 2019-12-09 08:54:40 -0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-11 09:37:34 +0100 |
| commit | 74e14541137d444b01fa947d7408f9d4a049ad9d (patch) | |
| tree | 471926cdb1344b0275c19fae72c69766c411519e /django/forms/widgets.py | |
| parent | 314cb3a976ef642b8b941a47da90d0277eaa0038 (diff) | |
[3.0.x] Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.
Backport of 02eff7ef60466da108b1a33f1e4dc01eec45c99d from master
Diffstat (limited to 'django/forms/widgets.py')
| -rw-r--r-- | django/forms/widgets.py | 4 |
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): |
