Fixes #11345 - Fix module validation (#11346)

* Make sure we bail out if field validation failed when importing modules

* Tweak form validation logic

Co-authored-by: jeremystretch <jstretch@ns1.com>
This commit is contained in:
kkthxbye
2023-01-03 15:14:25 +01:00
committed by GitHub
parent cdebd785b6
commit 3d7260aec5
2 changed files with 6 additions and 5 deletions

View File

@@ -961,7 +961,7 @@ class Module(PrimaryModel, ConfigContextModel):
def clean(self):
super().clean()
if self.module_bay.device != self.device:
if hasattr(self, "module_bay") and (self.module_bay.device != self.device):
raise ValidationError(
f"Module must be installed within a module bay belonging to the assigned device ({self.device})."
)