Skip to content

Commit

Permalink
fix: formfield overrides (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav authored Jan 14, 2024
1 parent b412b20 commit 3a10c02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/unfold/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3a10c02

Please sign in to comment.