mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix instance evaluation
This commit is contained in:
@ -107,7 +107,7 @@ class ObjectPermissionForm(forms.ModelForm):
|
|||||||
self.fields['content_types'].choices.insert(0, ('', '---------'))
|
self.fields['content_types'].choices.insert(0, ('', '---------'))
|
||||||
|
|
||||||
# Check the appropriate checkboxes when editing an existing ObjectPermission
|
# Check the appropriate checkboxes when editing an existing ObjectPermission
|
||||||
if self.instance:
|
if self.instance.pk:
|
||||||
for action in ['view', 'add', 'change', 'delete']:
|
for action in ['view', 'add', 'change', 'delete']:
|
||||||
if action in self.instance.actions:
|
if action in self.instance.actions:
|
||||||
self.fields[f'can_{action}'].initial = True
|
self.fields[f'can_{action}'].initial = True
|
||||||
|
Reference in New Issue
Block a user