mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Fixes #6123: Prevent device from being assigned to mismatched site and location
This commit is contained in:
parent
6efe54aa88
commit
7439faad34
@ -16,6 +16,7 @@
|
|||||||
* [#6106](https://github.com/netbox-community/netbox/issues/6106) - Allow assigning a virtual interface as the parent of an existing interface
|
* [#6106](https://github.com/netbox-community/netbox/issues/6106) - Allow assigning a virtual interface as the parent of an existing interface
|
||||||
* [#6107](https://github.com/netbox-community/netbox/issues/6107) - Fix rack selection field on device form
|
* [#6107](https://github.com/netbox-community/netbox/issues/6107) - Fix rack selection field on device form
|
||||||
* [#6110](https://github.com/netbox-community/netbox/issues/6110) - Fix handling of TemplateColumn values for table export
|
* [#6110](https://github.com/netbox-community/netbox/issues/6110) - Fix handling of TemplateColumn values for table export
|
||||||
|
* [#6123](https://github.com/netbox-community/netbox/issues/6123) - Prevent device from being assigned to mismatched site and location
|
||||||
* [#6130](https://github.com/netbox-community/netbox/issues/6130) - Improve display of assigned models in custom fields list
|
* [#6130](https://github.com/netbox-community/netbox/issues/6130) - Improve display of assigned models in custom fields list
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -652,6 +652,10 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'rack': f"Rack {self.rack} does not belong to site {self.site}.",
|
'rack': f"Rack {self.rack} does not belong to site {self.site}.",
|
||||||
})
|
})
|
||||||
|
if self.location and self.site != self.location.site:
|
||||||
|
raise ValidationError({
|
||||||
|
'location': f"Location {self.location} does not belong to site {self.site}.",
|
||||||
|
})
|
||||||
if self.rack and self.location and self.rack.location != self.location:
|
if self.rack and self.location and self.rack.location != self.location:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'rack': f"Rack {self.rack} does not belong to location {self.location}.",
|
'rack': f"Rack {self.rack} does not belong to location {self.location}.",
|
||||||
|
Loading…
Reference in New Issue
Block a user