File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ class Meta:
41
41
fields = '__all__'
42
42
43
43
def clean (self ):
44
- if self .cleaned_data ['type' ] != 'relation' and self .cleaned_data ['target_servertype' ] is not None :
44
+ attr_type = self .cleaned_data .get ('type' ) or self .instance .type # New or existing attribute ?
45
+
46
+ if attr_type != 'relation' and self .cleaned_data .get ('target_servertype' ) is not None :
45
47
raise ValidationError ('Attribute type must be relation when target servertype is selected!' )
46
48
47
- if self . cleaned_data [ 'type' ] == 'inet' and self .cleaned_data [ 'multi' ] is True :
49
+ if attr_type == 'inet' and self .cleaned_data . get ( 'multi' ) is True :
48
50
raise ValidationError ('Multi attributes of type inet are not supported!' )
49
51
50
52
super ().clean ()
You can’t perform that action at this time.
0 commit comments