File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -236,17 +236,18 @@ def clean(self):
236
236
host_type : [error_same_acl_name ],
237
237
"name" : [error_same_acl_name ],
238
238
}
239
- # Check if Access List has no existing rules before change the Access List's type.
240
- if (
241
- acl_type == ACLTypeChoices .TYPE_EXTENDED
242
- and self .instance .aclstandardrules .exists ()
243
- ) or (
244
- acl_type == ACLTypeChoices .TYPE_STANDARD
245
- and self .instance .aclextendedrules .exists ()
246
- ):
247
- error_message ["type" ] = [
248
- "This ACL has ACL rules associated, CANNOT change ACL type." ,
249
- ]
239
+ if self .instance .pk :
240
+ # Check if Access List has no existing rules before change the Access List's type.
241
+ if (
242
+ acl_type == ACLTypeChoices .TYPE_EXTENDED
243
+ and self .instance .aclstandardrules .exists ()
244
+ ) or (
245
+ acl_type == ACLTypeChoices .TYPE_STANDARD
246
+ and self .instance .aclextendedrules .exists ()
247
+ ):
248
+ error_message ["type" ] = [
249
+ "This ACL has ACL rules associated, CANNOT change ACL type." ,
250
+ ]
250
251
251
252
if error_message :
252
253
raise forms .ValidationError (error_message )
You can’t perform that action at this time.
0 commit comments