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
This commit is contained in:
parent
9723a2f0ad
commit
b5a9cb1762
|
|
@ -372,6 +372,9 @@ class ObjectPermissionForm(forms.ModelForm):
|
|||
elif self.initial:
|
||||
# Handle cloned objects - actions come from initial data (URL parameters)
|
||||
if 'actions' in self.initial:
|
||||
# Normalize actions to a list of strings
|
||||
if isinstance(self.initial['actions'], str):
|
||||
self.initial['actions'] = [self.initial['actions']]
|
||||
if cloned_actions := self.initial['actions']:
|
||||
for action in ['view', 'add', 'change', 'delete']:
|
||||
if action in cloned_actions:
|
||||
|
|
|
|||
Loading…
Reference in New Issue