Skip to content

Commit b5a9cb1

Browse files
pheusjeremystretch
authored andcommitted
fix(users): Normalize actions in cloned objects init
Ensure `actions` are consistently normalized to a list of strings during cloned object initialization. This resolves potential type mismatches when processing user form data. Fixes #20750
1 parent 9723a2f commit b5a9cb1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

netbox/users/forms/model_forms.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ def __init__(self, *args, **kwargs):
372372
elif self.initial:
373373
# Handle cloned objects - actions come from initial data (URL parameters)
374374
if 'actions' in self.initial:
375+
# Normalize actions to a list of strings
376+
if isinstance(self.initial['actions'], str):
377+
self.initial['actions'] = [self.initial['actions']]
375378
if cloned_actions := self.initial['actions']:
376379
for action in ['view', 'add', 'change', 'delete']:
377380
if action in cloned_actions:

0 commit comments

Comments
 (0)