mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #5665: Validate rack group is assigned to same site when creating a rack
This commit is contained in:
@ -17,6 +17,7 @@
|
|||||||
* [#5603](https://github.com/netbox-community/netbox/issues/5603) - Fix display of white cables in trace view
|
* [#5603](https://github.com/netbox-community/netbox/issues/5603) - Fix display of white cables in trace view
|
||||||
* [#5639](https://github.com/netbox-community/netbox/issues/5639) - Fix filtering connection lists by device name
|
* [#5639](https://github.com/netbox-community/netbox/issues/5639) - Fix filtering connection lists by device name
|
||||||
* [#5640](https://github.com/netbox-community/netbox/issues/5640) - Fix permissions assessment when adding VM interfaces in bulk
|
* [#5640](https://github.com/netbox-community/netbox/issues/5640) - Fix permissions assessment when adding VM interfaces in bulk
|
||||||
|
* [#5665](https://github.com/netbox-community/netbox/issues/5665) - Validate rack group is assigned to same site when creating a rack
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -299,6 +299,10 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
|
|||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
|
|
||||||
|
# Validate group/site assignment
|
||||||
|
if self.site and self.group and self.group.site != self.site:
|
||||||
|
raise ValidationError(f"Assigned rack group must belong to parent site ({self.site}).")
|
||||||
|
|
||||||
# Validate outer dimensions and unit
|
# Validate outer dimensions and unit
|
||||||
if (self.outer_width is not None or self.outer_depth is not None) and not self.outer_unit:
|
if (self.outer_width is not None or self.outer_depth is not None) and not self.outer_unit:
|
||||||
raise ValidationError("Must specify a unit when setting an outer width/depth")
|
raise ValidationError("Must specify a unit when setting an outer width/depth")
|
||||||
|
Reference in New Issue
Block a user