Skip to content

Commit

Permalink
Update data-validation.md
Browse files Browse the repository at this point in the history
Issues to change the documentation
netbox-community#16076

PROTECTION_RULES extended by an example of what works in the WEB UI.
  • Loading branch information
LHBL2003 authored May 17, 2024
1 parent cca1b0a commit 062295d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/configuration/data-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ The following colors are supported:

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:

**Example prevents the deletion of a site entry:**
```python
PROTECTION_RULES = {
"dcim.site": [
Expand All @@ -108,3 +109,34 @@ PROTECTION_RULES = {
]
}
```

### Configuration via Web UI

![image](https://github.com/netbox-community/netbox/assets/46369917/6fb69ab8-1f13-4b86-b84c-ce697af8f679)

**Path:**
- WebUI (v3.x.x) --> Admin --> Configuration Config Revisions --> Add (or Edit last Config)
- WebUI (v4.0.0) --> Admin --> Configuration History --> Add (or Edit last Config)

**Example prevents the deletion of a device entry:**
```python
{
"dcim.device": [
{
"status": {
"eq": "decommissioning"
}
}
]
}
```

If you navigate to a device, rack or site, you will find the path in the top right-hand corner.

![image](https://github.com/netbox-community/netbox/assets/46369917/3f1c8f12-0714-4590-99d7-41ef5da7c1c3)

Examples:
- dcim.device
- dcim.site
- dcim.rack
```

0 comments on commit 062295d

Please sign in to comment.