Skip to content

Commit 3a10c02

Browse files
authored
fix: formfield overrides (#256)
1 parent b412b20 commit 3a10c02

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/unfold/admin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@
129129
}
130130
)
131131

132-
CHANGE_FORM_FORMFIELD_OVERRIDES = copy.deepcopy(FORMFIELD_OVERRIDES)
133-
CHANGE_FORM_FORMFIELD_OVERRIDES.update(
134-
{models.BooleanField: {"widget": UnfoldBooleanSwitchWidget}}
135-
)
136-
137132
FORMFIELD_OVERRIDES_INLINE = copy.deepcopy(FORMFIELD_OVERRIDES)
138133

139134
FORMFIELD_OVERRIDES_INLINE.update(
@@ -536,7 +531,12 @@ def changeform_view(
536531
if extra_context is None:
537532
extra_context = {}
538533

539-
self.formfield_overrides = CHANGE_FORM_FORMFIELD_OVERRIDES
534+
new_formfield_overrides = copy.deepcopy(self.formfield_overrides)
535+
new_formfield_overrides.update(
536+
{models.BooleanField: {"widget": UnfoldBooleanSwitchWidget}}
537+
)
538+
539+
self.formfield_overrides = new_formfield_overrides
540540

541541
actions = []
542542
if object_id:

0 commit comments

Comments
 (0)