Document remaining primary/organizational/nestedgroup resources for the plugins API (except GraphQL types & filters)

This commit is contained in:
Jeremy Stretch
2025-12-04 15:29:34 -05:00
parent dfbc795299
commit 72c0567ced
5 changed files with 78 additions and 16 deletions

View File

@@ -67,23 +67,45 @@ class MyModel(ExportTemplatesMixin, TagsMixin, models.Model):
...
```
## Additional Models
### Additional Models
In addition to the base NetBoxModel class, the following additional classes are provided for convenience.
!!! info "These base classes were added to the plugins API in NetBox v4.5."
!!! info "These model classes were added to the plugins API in NetBox v4.5."
### PrimaryModel
#### PrimaryModel
PrimaryModel is the go-to class for most object types. It extends NetBoxModel with `description` and `comments` fields, and it introduces support for ownership assignment.
### OrganizationalModel
| Field | Required | Unique | Description |
|---------------|----------|--------|---------------------------------------------|
| `owner` | No | No | The object's owner |
| `description` | No | No | A human-friendly description for the object |
| `comments` | No | No | General comments |
OrganizationalModel is used by object types whose function is primarily the organization of other objects. It adds to NetBoxModel fields for `name`, `slug`, and `description`. It also supports ownership assignment.
#### OrganizationalModel
### NestedGroupModel
OrganizationalModel is used by object types whose function is primarily the organization of other objects.
NestedGroupModel is used for objects which arrange into a recursive hierarchy (like regions and locations) via its self-referential `parent` foreign key. It adds to NetBoxModel fields for `name`, `slug`, `description`, and `comments`. It also supports ownership assignment.
| Field | Required | Unique | Description |
|---------------|----------|--------|---------------------------------------------|
| `name` | Yes | Yes | The name of the object |
| `slug` | Yes | Yes | A unique URL-friendly identifier |
| `owner` | No | No | The object's owner |
| `description` | No | No | A human-friendly description for the object |
#### NestedGroupModel
NestedGroupModel is used for objects which arrange into a recursive hierarchy (like regions and locations) via its self-referential `parent` foreign key.
| Field | Required | Unique | Description |
|---------------|----------|--------|-----------------------------------------------------------------|
| `name` | Yes | Yes | The name of the object |
| `slug` | Yes | Yes | A unique URL-friendly identifier |
| `parent` | No | No | The object (of the same type) under which this object is nested |
| `owner` | No | No | The object's owner |
| `description` | No | No | A human-friendly description for the object |
| `comments` | No | No | General comments |
## Database Migrations