1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

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 5975dbcb07
commit e1169e7ea6
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})."
)