Skip to content

Commit 7b90481

Browse files
Merge pull request #14636 from netbox-community/develop
Release v3.7.0
2 parents 0c06725 + d99e651 commit 7b90481

File tree

400 files changed

+81924
-3878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+81924
-3878
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body:
2323
attributes:
2424
label: NetBox Version
2525
description: What version of NetBox are you currently running?
26-
placeholder: v3.6.9
26+
placeholder: v3.7.0
2727
validations:
2828
required: true
2929
- type: dropdown

.github/ISSUE_TEMPLATE/feature_request.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
attributes:
1515
label: NetBox version
1616
description: What version of NetBox are you currently running?
17-
placeholder: v3.6.9
17+
placeholder: v3.7.0
1818
validations:
1919
required: true
2020
- type: dropdown

base_requirements.txt

+3-9
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ django-tables2
5353

5454
# User-defined tags for objects
5555
# https://github.com/jazzband/django-taggit/blob/master/CHANGELOG.rst
56-
# TODO: Upgrade to v5.0 for NetBox v3.7 beta
57-
django-taggit<5.0
56+
django-taggit
5857

5958
# A Django field for representing time zones
6059
# https://github.com/mfogel/django-timezone-field/
@@ -90,9 +89,8 @@ gunicorn
9089
Jinja2
9190

9291
# Simple markup language for rendering HTML
93-
# https://python-markdown.github.io/change_log/
94-
# mkdocs currently requires Markdown v3.3
95-
Markdown<3.4
92+
# https://python-markdown.github.io/changelog/
93+
Markdown
9694

9795
# File inclusion plugin for Python-Markdown
9896
# https://github.com/cmacmackin/markdown-include
@@ -126,10 +124,6 @@ PyYAML
126124
# https://github.com/psf/requests/blob/main/HISTORY.md
127125
requests
128126

129-
# Sentry SDK
130-
# https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md
131-
sentry-sdk
132-
133127
# Social authentication framework
134128
# https://github.com/python-social-auth/social-core/blob/master/CHANGELOG.md
135129
social-auth-core

docs/administration/error-reporting.md

+3-15
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@
44

55
### Enabling Error Reporting
66

7-
NetBox supports native integration with [Sentry](https://sentry.io/) for automatic error reporting. To enable this functionality, simply set `SENTRY_ENABLED` to True in `configuration.py`. Errors will be sent to a Sentry ingestor maintained by the NetBox team for analysis.
8-
9-
```python
10-
SENTRY_ENABLED = True
11-
```
12-
13-
### Using a Custom DSN
14-
15-
If you prefer instead to use your own Sentry ingestor, you'll need to first create a new project under your Sentry account to represent your NetBox deployment and obtain its corresponding data source name (DSN). This looks like a URL similar to the example below:
16-
17-
```
18-
19-
```
20-
21-
Once you have obtained a DSN, configure Sentry in NetBox's `configuration.py` file with the following parameters:
7+
NetBox supports native integration with [Sentry](https://sentry.io/) for automatic error reporting. To enable this functionality, set `SENTRY_ENABLED` to True and define your unique [data source name (DSN)](https://docs.sentry.io/product/sentry-basics/concepts/dsn-explainer/) in `configuration.py`.
228

239
```python
2410
SENTRY_ENABLED = True
2511
SENTRY_DSN = "https://[email protected]/0"
2612
```
2713

14+
Setting `SENTRY_ENABLED` to False will disable the Sentry integration.
15+
2816
### Assigning Tags
2917

3018
You can optionally attach one or more arbitrary tags to the outgoing error reports if desired by setting the `SENTRY_TAGS` parameter:

docs/configuration/data-validation.md

+21
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,24 @@ The following colors are supported:
8787
* `gray`
8888
* `black`
8989
* `white`
90+
91+
---
92+
93+
## PROTECTION_RULES
94+
95+
!!! tip "Dynamic Configuration Parameter"
96+
97+
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:
98+
99+
```python
100+
PROTECTION_RULES = {
101+
"dcim.site": [
102+
{
103+
"status": {
104+
"eq": "decommissioning"
105+
}
106+
},
107+
"my_plugin.validators.Validator1",
108+
]
109+
}
110+
```

docs/configuration/error-reporting.md

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Default: False
1818

1919
Set to True to enable automatic error reporting via [Sentry](https://sentry.io/).
2020

21+
!!! note
22+
The `sentry-sdk` Python package is required to enable Sentry integration.
23+
2124
---
2225

2326
## SENTRY_SAMPLE_RATE

docs/configuration/miscellaneous.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ changes in the database indefinitely.
8080

8181
---
8282

83+
## CHANGELOG_SKIP_EMPTY_CHANGES
84+
85+
Default: True
86+
87+
If enabled, a change log record will not be created when an object is updated without any changes to its existing field values.
88+
89+
!!! note
90+
The object's `last_updated` field will always reflect the time of the most recent update, regardless of this parameter.
91+
92+
---
93+
8394
## DATA_UPLOAD_MAX_MEMORY_SIZE
8495

8596
Default: `2621440` (2.5 MB)
@@ -92,9 +103,12 @@ The maximum size (in bytes) of an incoming HTTP request (i.e. `GET` or `POST` da
92103

93104
!!! tip "Dynamic Configuration Parameter"
94105

95-
Default: False
106+
Default: True
107+
108+
By default, NetBox will prevent the creation of duplicate prefixes and IP addresses in the global table (that is, those which are not assigned to any VRF). This validation can be disabled by setting `ENFORCE_GLOBAL_UNIQUE` to False.
96109

97-
By default, NetBox will permit users to create duplicate prefixes and IP addresses in the global table (that is, those which are not assigned to any VRF). This behavior can be disabled by setting `ENFORCE_GLOBAL_UNIQUE` to True.
110+
!!! info "Changed in v3.7"
111+
The default value for this parameter was changed from False to True in NetBox v3.7.
98112

99113
---
100114

docs/configuration/required-parameters.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ DATABASE = {
5959

6060
## REDIS
6161

62-
[Redis](https://redis.io/) is an in-memory data store similar to memcached. While Redis has been an optional component of
63-
NetBox since the introduction of webhooks in version 2.4, it is required starting in 2.6 to support NetBox's caching
64-
functionality (as well as other planned features). In 2.7, the connection settings were broken down into two sections for
65-
task queuing and caching, allowing the user to connect to different Redis instances/databases per feature.
62+
[Redis](https://redis.io/) is a lightweight in-memory data store similar to memcached. NetBox employs Redis for background task queuing and other features.
6663

6764
Redis is configured using a configuration setting similar to `DATABASE` and these settings are the same for both of the `tasks` and `caching` subsections:
6865

@@ -81,15 +78,15 @@ REDIS = {
8178
'tasks': {
8279
'HOST': 'redis.example.com',
8380
'PORT': 1234,
84-
'USERNAME': 'netbox'
81+
'USERNAME': 'netbox',
8582
'PASSWORD': 'foobar',
8683
'DATABASE': 0,
8784
'SSL': False,
8885
},
8986
'caching': {
9087
'HOST': 'localhost',
9188
'PORT': 6379,
92-
'USERNAME': ''
89+
'USERNAME': '',
9390
'PASSWORD': '',
9491
'DATABASE': 1,
9592
'SSL': False,

docs/customization/custom-fields.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,22 @@ Related custom fields can be grouped together within the UI by assigning each th
4040

4141
This parameter has no effect on the API representation of custom field data.
4242

43-
### Visibility
43+
### Visibility & Editing
4444

45-
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.
45+
!!! info "This feature was improved in NetBox v3.7."
4646

47-
* **Read/write** (default): The custom field is included when viewing and editing objects.
48-
* **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.)
47+
When creating a custom field, users can control the conditions under which it may be displayed and edited within the NetBox user interface. The following choices are available for controlling the display of a custom field on an object:
48+
49+
* **Always** (default): The custom field is included when viewing an object.
50+
* **If Set**: The custom field is included only if a value has been defined for the object.
4951
* **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.
5052

53+
Additionally, the following options are available for controlling whether custom field values can be altered within the NetBox UI:
54+
55+
* **Yes** (default): The custom field's value may be modified when editing an object.
56+
* **No**: The custom field is displayed for reference when editing an object, but its value may not be modified.
57+
* **Hidden**: The custom field is not displayed when editing an object.
58+
5159
Note that this setting has no impact on the REST or GraphQL APIs: Custom field data will always be available via either API.
5260

5361
### Validation

docs/customization/custom-validation.md

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ The `CustomValidator` class supports several validation types:
2626
* `regex`: Application of a [regular expression](https://en.wikipedia.org/wiki/Regular_expression)
2727
* `required`: A value must be specified
2828
* `prohibited`: A value must _not_ be specified
29+
* `eq`: A value must be equal to the specified value
30+
* `neq`: A value must _not_ be equal to the specified value
2931

3032
The `min` and `max` types should be defined for numeric values, whereas `min_length`, `max_length`, and `regex` are suitable for character strings (text values). The `required` and `prohibited` validators may be used for any field, and should be passed a value of `True`.
3133

docs/development/application-registry.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ A dictionary of particular features (e.g. custom fields) mapped to the NetBox mo
3131
'dcim': ['site', 'rack', 'devicetype', ...],
3232
...
3333
},
34-
'webhooks': {
34+
'event_rules': {
3535
'extras': ['configcontext', 'tag', ...],
3636
'dcim': ['site', 'rack', 'devicetype', ...],
3737
},
@@ -41,6 +41,10 @@ A dictionary of particular features (e.g. custom fields) mapped to the NetBox mo
4141

4242
Supported model features are listed in the [features matrix](./models.md#features-matrix).
4343

44+
### `models`
45+
46+
This key lists all models which have been registered in NetBox which are not designated for private use. (Setting `_netbox_private` to True on a model excludes it from this list.) As with individual features under `model_features`, models are organized by app label.
47+
4448
### `plugins`
4549

4650
This store maintains all registered items for plugins, such as navigation menus, template extensions, etc.
@@ -49,6 +53,10 @@ This store maintains all registered items for plugins, such as navigation menus,
4953

5054
A dictionary mapping each model (identified by its app and label) to its search index class, if one has been registered for it.
5155

56+
### `tables`
57+
58+
A dictionary mapping table classes to lists of extra columns that have been registered by plugins using the `register_table_column()` utility function. Each column is defined as a tuple of name and column instance.
59+
5260
### `views`
5361

5462
A hierarchical mapping of registered views for each model. Mappings are added using the `register_model_view()` decorator, and URLs paths can be generated from these using `get_model_urls()`.

docs/development/extending-models.md

+26-13
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22

33
Below is a list of tasks to consider when adding a new field to a core model.
44

5-
## 1. Generate and run database migrations
5+
## 1. Add the field to the model class
6+
7+
Add the field to the model, taking care to address any of the following conditions.
8+
9+
* When adding a GenericForeignKey field, also add an index under `Meta` for its two concrete fields. For example:
10+
11+
```python
12+
class Meta:
13+
indexes = (
14+
models.Index(fields=('object_type', 'object_id')),
15+
)
16+
```
17+
18+
## 2. Generate and run database migrations
619

720
[Django migrations](https://docs.djangoproject.com/en/stable/topics/migrations/) are used to express changes to the database schema. In most cases, Django can generate these automatically, however very complex changes may require manual intervention. Always remember to specify a short but descriptive name when generating a new migration.
821

922
```
10-
./manage.py makemigrations <app> -n <name>
23+
./manage.py makemigrations <app> -n <name> --no-header
1124
./manage.py migrate
1225
```
1326
@@ -16,7 +29,7 @@ Where possible, try to merge related changes into a single migration. For exampl
1629
!!! warning "Do not alter existing migrations"
1730
Migrations can only be merged within a release. Once a new release has been published, its migrations cannot be altered (other than for the purpose of correcting a bug).
1831
19-
## 2. Add validation logic to `clean()`
32+
## 3. Add validation logic to `clean()`
2033
2134
If the new field introduces additional validation requirements (beyond what's included with the field itself), implement them in the model's `clean()` method. Remember to call the model's original method using `super()` before or after your custom validation as appropriate:
2235
@@ -31,15 +44,15 @@ class Foo(models.Model):
3144
raise ValidationError()
3245
```
3346
34-
## 3. Update relevant querysets
47+
## 4. Update relevant querysets
3548
3649
If you're adding a relational field (e.g. `ForeignKey`) and intend to include the data when retrieving a list of objects, be sure to include the field using `prefetch_related()` as appropriate. This will optimize the view and avoid extraneous database queries.
3750
38-
## 4. Update API serializer
51+
## 5. Update API serializer
3952
4053
Extend the model's API serializer in `<app>.api.serializers` to include the new field. In most cases, it will not be necessary to also extend the nested serializer, which produces a minimal representation of the model.
4154
42-
## 5. Add fields to forms
55+
## 6. Add fields to forms
4356
4457
Extend any forms to include the new field(s) as appropriate. These are found under the `forms/` directory within each app. Common forms include:
4558
@@ -48,23 +61,23 @@ Extend any forms to include the new field(s) as appropriate. These are found und
4861
* **CSV import** - The form used when bulk importing objects in CSV format
4962
* **Filter** - Displays the options available for filtering a list of objects (both UI and API)
5063
51-
## 6. Extend object filter set
64+
## 7. Extend object filter set
5265
5366
If the new field should be filterable, add it to the `FilterSet` for the model. If the field should be searchable, remember to query it in the FilterSet's `search()` method.
5467
55-
## 7. Add column to object table
68+
## 8. Add column to object table
5669
5770
If the new field will be included in the object list view, add a column to the model's table. For simple fields, adding the field name to `Meta.fields` will be sufficient. More complex fields may require declaring a custom column. Also add the field name to `default_columns` if the column should be present in the table by default.
5871
59-
## 8. Update the SearchIndex
72+
## 9. Update the SearchIndex
6073
6174
Where applicable, add the new field to the model's SearchIndex for inclusion in global search.
6275
63-
## 9. Update the UI templates
76+
## 10. Update the UI templates
6477
6578
Edit the object's view template to display the new field. There may also be a custom add/edit form template that needs to be updated.
6679
67-
## 10. Create/extend test cases
80+
## 11. Create/extend test cases
6881
6982
Create or extend the relevant test cases to verify that the new field and any accompanying validation logic perform as expected. This is especially important for relational fields. NetBox incorporates various test suites, including:
7083
@@ -74,8 +87,8 @@ Create or extend the relevant test cases to verify that the new field and any ac
7487
* Model tests
7588
* View tests
7689
77-
Be diligent to ensure all of the relevant test suites are adapted or extended as necessary to test any new functionality.
90+
Be diligent to ensure all the relevant test suites are adapted or extended as necessary to test any new functionality.
7891
79-
## 11. Update the model's documentation
92+
## 12. Update the model's documentation
8093
8194
Each model has a dedicated page in the documentation, at `models/<app>/<model>.md`. Update this file to include any relevant information about the new field.

0 commit comments

Comments
 (0)