From 3a10c026744bed9f0931b0f227cbefc032f436ff Mon Sep 17 00:00:00 2001 From: Lukas Vinclav Date: Sun, 14 Jan 2024 13:04:33 +0100 Subject: [PATCH] fix: formfield overrides (#256) --- src/unfold/admin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/unfold/admin.py b/src/unfold/admin.py index b3781841..3bea67b6 100644 --- a/src/unfold/admin.py +++ b/src/unfold/admin.py @@ -129,11 +129,6 @@ } ) -CHANGE_FORM_FORMFIELD_OVERRIDES = copy.deepcopy(FORMFIELD_OVERRIDES) -CHANGE_FORM_FORMFIELD_OVERRIDES.update( - {models.BooleanField: {"widget": UnfoldBooleanSwitchWidget}} -) - FORMFIELD_OVERRIDES_INLINE = copy.deepcopy(FORMFIELD_OVERRIDES) FORMFIELD_OVERRIDES_INLINE.update( @@ -536,7 +531,12 @@ def changeform_view( if extra_context is None: extra_context = {} - self.formfield_overrides = CHANGE_FORM_FORMFIELD_OVERRIDES + new_formfield_overrides = copy.deepcopy(self.formfield_overrides) + new_formfield_overrides.update( + {models.BooleanField: {"widget": UnfoldBooleanSwitchWidget}} + ) + + self.formfield_overrides = new_formfield_overrides actions = [] if object_id: