mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Documentation cleanup
This commit is contained in:
@ -212,6 +212,7 @@ The following model fields support configurable choices:
|
|||||||
|
|
||||||
* `circuits.Circuit.status`
|
* `circuits.Circuit.status`
|
||||||
* `dcim.Device.status`
|
* `dcim.Device.status`
|
||||||
|
* `dcim.Location.status`
|
||||||
* `dcim.PowerFeed.status`
|
* `dcim.PowerFeed.status`
|
||||||
* `dcim.Rack.status`
|
* `dcim.Rack.status`
|
||||||
* `dcim.Site.status`
|
* `dcim.Site.status`
|
||||||
@ -220,6 +221,7 @@ The following model fields support configurable choices:
|
|||||||
* `ipam.IPRange.status`
|
* `ipam.IPRange.status`
|
||||||
* `ipam.Prefix.status`
|
* `ipam.Prefix.status`
|
||||||
* `ipam.VLAN.status`
|
* `ipam.VLAN.status`
|
||||||
|
* `virtualization.Cluster.status`
|
||||||
* `virtualization.VirtualMachine.status`
|
* `virtualization.VirtualMachine.status`
|
||||||
|
|
||||||
The following colors are supported:
|
The following colors are supported:
|
||||||
|
@ -26,11 +26,35 @@ Each custom field must have a name. This should be a simple database-friendly st
|
|||||||
|
|
||||||
Marking a field as required will force the user to provide a value for the field when creating a new object or when saving an existing object. A default value for the field may also be provided. Use "true" or "false" for boolean fields, or the exact value of a choice for selection fields.
|
Marking a field as required will force the user to provide a value for the field when creating a new object or when saving an existing object. A default value for the field may also be provided. Use "true" or "false" for boolean fields, or the exact value of a choice for selection fields.
|
||||||
|
|
||||||
The filter logic controls how values are matched when filtering objects by the custom field. Loose filtering (the default) matches on a partial value, whereas exact matching requires a complete match of the given string to a field's value. For example, exact filtering with the string "red" will only match the exact value "red", whereas loose filtering will match on the values "red", "red-orange", or "bored". Setting the filter logic to "disabled" disables filtering by the field entirely.
|
|
||||||
|
|
||||||
A custom field must be assigned to one or more object types, or models, in NetBox. Once created, custom fields will automatically appear as part of these models in the web UI and REST API. Note that not all models support custom fields.
|
A custom field must be assigned to one or more object types, or models, in NetBox. Once created, custom fields will automatically appear as part of these models in the web UI and REST API. Note that not all models support custom fields.
|
||||||
|
|
||||||
### Custom Field Validation
|
### Filtering
|
||||||
|
|
||||||
|
The filter logic controls how values are matched when filtering objects by the custom field. Loose filtering (the default) matches on a partial value, whereas exact matching requires a complete match of the given string to a field's value. For example, exact filtering with the string "red" will only match the exact value "red", whereas loose filtering will match on the values "red", "red-orange", or "bored". Setting the filter logic to "disabled" disables filtering by the field entirely.
|
||||||
|
|
||||||
|
### Grouping
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This feature was introduced in NetBox v3.3.
|
||||||
|
|
||||||
|
Related custom fields can be grouped together within the UI by assigning each the same group name. When at least one custom field for an object type has a group defined, it will appear under the group heading within the custom fields panel under the object view. All custom fields with the same group name will appear under that heading. (Note that the group names must match exactly, or each will appear as a separate heading.)
|
||||||
|
|
||||||
|
This parameter has no effect on the API representation of custom field data.
|
||||||
|
|
||||||
|
### Visibility
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This feature was introduced in NetBox v3.3.
|
||||||
|
|
||||||
|
When creating a custom field, there are three options for UI visibility. These control how and whether the custom field is displayed within the NetBox UI.
|
||||||
|
|
||||||
|
* **Read/write** (default): The custom field is included when viewing and editing objects.
|
||||||
|
* **Read-only**: The custom field is displayed when viewing an object, but it cannot be edited via the UI. (It will appear in the form as a read-only field.)
|
||||||
|
* **Hidden**: The custom field will never be displayed within the UI. This option is recommended for fields which are not intended for use by human users.
|
||||||
|
|
||||||
|
Note that this setting has no impact on the REST or GraphQL APIs: Custom field data will always be available via either API.
|
||||||
|
|
||||||
|
### Validation
|
||||||
|
|
||||||
NetBox supports limited custom validation for custom field values. Following are the types of validation enforced for each field type:
|
NetBox supports limited custom validation for custom field values. Following are the types of validation enforced for each field type:
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ To achieve a logical OR with a different set of constraints, define multiple obj
|
|||||||
|
|
||||||
Additionally, where multiple permissions have been assigned for an object type, their collective constraints will be merged using a logical "OR" operation.
|
Additionally, where multiple permissions have been assigned for an object type, their collective constraints will be merged using a logical "OR" operation.
|
||||||
|
|
||||||
### Tokens
|
### User Token
|
||||||
|
|
||||||
!!! info "This feature was introduced in NetBox v3.3"
|
!!! info "This feature was introduced in NetBox v3.3"
|
||||||
|
|
||||||
|
@ -9,4 +9,11 @@ Each token contains a 160-bit key represented as 40 hexadecimal characters. When
|
|||||||
|
|
||||||
By default, a token can be used to perform all actions via the API that a user would be permitted to do via the web UI. Deselecting the "write enabled" option will restrict API requests made with the token to read operations (e.g. GET) only.
|
By default, a token can be used to perform all actions via the API that a user would be permitted to do via the web UI. Deselecting the "write enabled" option will restrict API requests made with the token to read operations (e.g. GET) only.
|
||||||
|
|
||||||
Additionally, a token can be set to expire at a specific time. This can be useful if an external client needs to be granted temporary access to NetBox. Tokens can also be restricted by IP range: If defined, authentication for API clients connecting from an IP address outside these ranges will fail.
|
Additionally, a token can be set to expire at a specific time. This can be useful if an external client needs to be granted temporary access to NetBox.
|
||||||
|
|
||||||
|
### Client IP Restriction
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This feature was introduced in NetBox v3.3.
|
||||||
|
|
||||||
|
Each API token can optionally be restricted by client IP address. If one or more allowed IP prefixes/addresses is defined for a token, authentication will fail for any client connecting from an IP address outside the defined range(s). This enables restricting the use a token to a specific client. (By default, any client IP address is permitted.)
|
||||||
|
@ -37,7 +37,7 @@ This class performs two crucial functions:
|
|||||||
1. Apply any fields, methods, and/or attributes necessary to the operation of these features
|
1. Apply any fields, methods, and/or attributes necessary to the operation of these features
|
||||||
2. Register the model with NetBox as utilizing these features
|
2. Register the model with NetBox as utilizing these features
|
||||||
|
|
||||||
Simply subclass BaseModel when defining a model in your plugin:
|
Simply subclass NetBoxModel when defining a model in your plugin:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# models.py
|
# models.py
|
||||||
@ -54,7 +54,7 @@ class MyModel(NetBoxModel):
|
|||||||
!!! info
|
!!! info
|
||||||
This method was introduced in NetBox v3.3.
|
This method was introduced in NetBox v3.3.
|
||||||
|
|
||||||
The `NetBoxModel` class includes a `clone()` method to be used for gathering attriubtes which can be used to create a "cloned" instance. This is used primarily for form initialization, e.g. when using the "clone" button in the NetBox UI. By default, this method will replicate any fields listed in the model's `clone_fields` list, if defined.
|
The `NetBoxModel` class includes a `clone()` method to be used for gathering attributes which can be used to create a "cloned" instance. This is used primarily for form initialization, e.g. when using the "clone" button in the NetBox UI. By default, this method will replicate any fields listed in the model's `clone_fields` list, if defined.
|
||||||
|
|
||||||
Plugin models can leverage this method by defining `clone_fields` as a list of field names to be replicated, or override this method to replace or extend its content:
|
Plugin models can leverage this method by defining `clone_fields` as a list of field names to be replicated, or override this method to replace or extend its content:
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ nav:
|
|||||||
- NetBox Shell: 'administration/netbox-shell.md'
|
- NetBox Shell: 'administration/netbox-shell.md'
|
||||||
- REST API:
|
- REST API:
|
||||||
- Overview: 'rest-api/overview.md'
|
- Overview: 'rest-api/overview.md'
|
||||||
- Filtering: 'rest-api/filtering.md'
|
- Filtering & Ordering: 'rest-api/filtering.md'
|
||||||
- Authentication: 'rest-api/authentication.md'
|
- Authentication: 'rest-api/authentication.md'
|
||||||
- GraphQL API:
|
- GraphQL API:
|
||||||
- Overview: 'graphql-api/overview.md'
|
- Overview: 'graphql-api/overview.md'
|
||||||
|
@ -31,7 +31,7 @@ def get_snapshots(instance, action):
|
|||||||
'postchange': None,
|
'postchange': None,
|
||||||
}
|
}
|
||||||
if action != ObjectChangeActionChoices.ACTION_DELETE:
|
if action != ObjectChangeActionChoices.ACTION_DELETE:
|
||||||
# Use model's serialize() method if defined; fall back to serialize_object
|
# Use model's serialize_object() method if defined; fall back to serialize_object() utility function
|
||||||
if hasattr(instance, 'serialize_object'):
|
if hasattr(instance, 'serialize_object'):
|
||||||
snapshots['postchange'] = instance.serialize_object()
|
snapshots['postchange'] = instance.serialize_object()
|
||||||
else:
|
else:
|
||||||
|
@ -72,7 +72,8 @@ class ObjectView(BaseObjectView):
|
|||||||
|
|
||||||
class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
|
class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
|
||||||
"""
|
"""
|
||||||
Display a table of child objects associated with the parent object.
|
Display a table of child objects associated with the parent object. For example, NetBox uses this to display
|
||||||
|
the set of child IP addresses within a parent prefix.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
child_model: The model class which represents the child objects
|
child_model: The model class which represents the child objects
|
||||||
|
@ -106,7 +106,7 @@ class TokenForm(BootstrapMixin, forms.ModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
label='Allowed IPs',
|
label='Allowed IPs',
|
||||||
help_text='Allowed IPv4/IPv6 networks from where the token can be used. Leave blank for no restrictions. '
|
help_text='Allowed IPv4/IPv6 networks from where the token can be used. Leave blank for no restrictions. '
|
||||||
'Ex: "10.1.1.0/24, 192.168.10.16/32, 2001:DB8:1::/64"',
|
'Example: <code>10.1.1.0/24,192.168.10.16/32,2001:db8:1::/64</code>',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Reference in New Issue
Block a user