File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -56,17 +56,18 @@ class ModuleCommonForm(forms.Form):
5656 def clean (self ):
5757 super ().clean ()
5858
59- replicate_components = self .cleaned_data .get (" replicate_components" )
60- adopt_components = self .cleaned_data .get (" adopt_components" )
59+ replicate_components = self .cleaned_data .get (' replicate_components' )
60+ adopt_components = self .cleaned_data .get (' adopt_components' )
6161 device = self .cleaned_data .get ('device' )
6262 module_type = self .cleaned_data .get ('module_type' )
6363 module_bay = self .cleaned_data .get ('module_bay' )
6464
6565 if adopt_components :
6666 self .instance ._adopt_components = True
6767
68- # Bail out if we are not installing a new module or if we are not replicating components
69- if self .instance .pk or not replicate_components :
68+ # Bail out if we are not installing a new module or if we are not replicating components (or if
69+ # validation has already failed)
70+ if self .errors or self .instance .pk or not replicate_components :
7071 self .instance ._disable_replication = True
7172 return
7273
Original file line number Diff line number Diff line change @@ -961,7 +961,7 @@ def get_status_color(self):
961961 def clean (self ):
962962 super ().clean ()
963963
964- if self .module_bay .device != self .device :
964+ if hasattr ( self , "module_bay" ) and ( self .module_bay .device != self .device ) :
965965 raise ValidationError (
966966 f"Module must be installed within a module bay belonging to the assigned device ({ self .device } )."
967967 )
You can’t perform that action at this time.
0 commit comments