Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update data-validation.md #16183

Closed
wants to merge 12 commits into from
27 changes: 27 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not needed. The above text references the example.

```python
PROTECTION_RULES = {
"dcim.site": [
Expand All @@ -108,3 +109,29 @@ PROTECTION_RULES = {
]
}
```

### Configuration via Web UI
Example prevents the deletion of a device entry:

```python
{
"dcim.device": [
{
"status": {
"eq": "decommissioning"
}
}
]
}
Comment on lines +114 to +125
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is essentially a duplication of the example above, and is not needed.


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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be a screenshot; it can just be an embedded tip.


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

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