mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Fixes: #5564 - Raise validation error if a PowerPortTemplate's draw exceeds maximum
This commit is contained in:
parent
3f2beea79d
commit
030b59fe27
@ -17,6 +17,7 @@
|
|||||||
* [#5557](https://github.com/netbox-community/netbox/issues/5557) - Fix VRF route target assignment via REST API
|
* [#5557](https://github.com/netbox-community/netbox/issues/5557) - Fix VRF route target assignment via REST API
|
||||||
* [#5558](https://github.com/netbox-community/netbox/issues/5558) - Fix regex validation support for custom URL fields
|
* [#5558](https://github.com/netbox-community/netbox/issues/5558) - Fix regex validation support for custom URL fields
|
||||||
* [#5563](https://github.com/netbox-community/netbox/issues/5563) - Fix power feed cable trace link
|
* [#5563](https://github.com/netbox-community/netbox/issues/5563) - Fix power feed cable trace link
|
||||||
|
* [#5564](https://github.com/netbox-community/netbox/issues/5564) - Raise validation error if a power port template's `allocated_draw` exceeds its `maximum_draw`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -164,6 +164,15 @@ class PowerPortTemplate(ComponentTemplateModel):
|
|||||||
allocated_draw=self.allocated_draw
|
allocated_draw=self.allocated_draw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super().clean()
|
||||||
|
|
||||||
|
if self.maximum_draw is not None and self.allocated_draw is not None:
|
||||||
|
if self.allocated_draw > self.maximum_draw:
|
||||||
|
raise ValidationError({
|
||||||
|
'allocated_draw': f"Allocated draw cannot exceed the maximum draw ({self.maximum_draw}W)."
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class PowerOutletTemplate(ComponentTemplateModel):
|
class PowerOutletTemplate(ComponentTemplateModel):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user