mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
Revision, images have been removed as I don't understand how to embed them correctly.
This commit is contained in:
parent
771ac8acd9
commit
e131436efd
@ -94,24 +94,8 @@ The following colors are supported:
|
|||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
|
|
||||||
This is a mapping of models to [custom validators](../customization/custom-validation.md) against which an object is evaluated immediately prior to its deletion. If validation fails, the object is not deleted. An example is provided below:
|
This is a mapping of models to [custom validators](../customization/custom-validation.md) against which an object is evaluated immediately prior to its deletion. If validation fails, the object is not deleted. The configuration can be carried out in the menu under “System/Configuration History/Custom validators”.
|
||||||
|
In the example, a device can only be deleted when it is set to the “decommissioning” status. Paths such as “dcim.device” can be found in the top right-hand corner when you open the page of a device. For a rack it would therefore be “dcim.rack”.
|
||||||
Example prevents the deletion of a site entry:
|
|
||||||
```python
|
|
||||||
PROTECTION_RULES = {
|
|
||||||
"dcim.site": [
|
|
||||||
{
|
|
||||||
"status": {
|
|
||||||
"eq": "decommissioning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"my_plugin.validators.Validator1",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration via Web UI
|
|
||||||
Example prevents the deletion of a device entry:
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
{
|
{
|
||||||
@ -124,13 +108,3 @@ Example prevents the deletion of a device entry:
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
[](./media/screenshots/Configuration-History-Protection-rules-Example.png)
|
|
||||||
|
|
||||||
If you navigate to a device, rack or site, you will find the path in the top right-hand corner:
|
|
||||||
|
|
||||||
[](./media/screenshots/Device-Type-Path-Example.png)
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
- dcim.device
|
|
||||||
- dcim.site
|
|
||||||
- dcim.rack
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
Loading…
Reference in New Issue
Block a user