Merge v3.1.7

This commit is contained in:
jeremystretch 2022-02-03 12:55:34 -05:00
commit 478eefb74c
56 changed files with 758 additions and 142 deletions

View File

@ -14,7 +14,11 @@ body:
attributes: attributes:
label: NetBox version label: NetBox version
description: What version of NetBox are you currently running? description: What version of NetBox are you currently running?
<<<<<<< HEAD
placeholder: v3.1.6 placeholder: v3.1.6
=======
placeholder: v3.1.7
>>>>>>> develop
validations: validations:
required: true required: true
- type: dropdown - type: dropdown

View File

@ -14,7 +14,11 @@ body:
attributes: attributes:
label: NetBox version label: NetBox version
description: What version of NetBox are you currently running? description: What version of NetBox are you currently running?
<<<<<<< HEAD
placeholder: v3.1.6 placeholder: v3.1.6
=======
placeholder: v3.1.7
>>>>>>> develop
validations: validations:
required: true required: true
- type: dropdown - type: dropdown

View File

@ -104,7 +104,7 @@ PyYAML
# Social authentication framework # Social authentication framework
# https://github.com/python-social-auth/social-core # https://github.com/python-social-auth/social-core
social-auth-core[all] social-auth-core
# Django app for social-auth-core # Django app for social-auth-core
# https://github.com/python-social-auth/social-app-django # https://github.com/python-social-auth/social-app-django

0
contrib/netbox-housekeeping.sh Normal file → Executable file
View File

View File

@ -1,5 +1,22 @@
{!models/extras/webhook.md!} {!models/extras/webhook.md!}
## Conditional Webhooks
A webhook may include a set of conditional logic expressed in JSON used to control whether a webhook triggers for a specific object. For example, you may wish to trigger a webhook for devices only when the `status` field of an object is "active":
```json
{
"and": [
{
"attr": "status.value",
"value": "active"
}
]
}
```
For more detail, see the reference documentation for NetBox's [conditional logic](../reference/conditions.md).
## Webhook Processing ## Webhook Processing
When a change is detected, any resulting webhooks are placed into a Redis queue for processing. This allows the user's request to complete without needing to wait for the outgoing webhook(s) to be processed. The webhooks are then extracted from the queue by the `rqworker` process and HTTP requests are sent to their respective destinations. The current webhook queue and any failed webhooks can be inspected in the admin UI under System > Background Tasks. When a change is detected, any resulting webhooks are placed into a Redis queue for processing. This allows the user's request to complete without needing to wait for the outgoing webhook(s) to be processed. The webhooks are then extracted from the queue by the `rqworker` process and HTTP requests are sent to their respective destinations. The current webhook queue and any failed webhooks can be inspected in the admin UI under System > Background Tasks.

View File

@ -3,7 +3,7 @@
NetBox includes a `housekeeping` management command that should be run nightly. This command handles: NetBox includes a `housekeeping` management command that should be run nightly. This command handles:
* Clearing expired authentication sessions from the database * Clearing expired authentication sessions from the database
* Deleting changelog records older than the configured [retention time](../configuration/optional-settings.md#changelog_retention) * Deleting changelog records older than the configured [retention time](../configuration/dynamic-settings.md#changelog_retention)
This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be linked from your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file. This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be linked from your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file.

View File

@ -77,6 +77,10 @@ This is the human-friendly names of your script. If omitted, the class name will
A human-friendly description of what your script does. A human-friendly description of what your script does.
### `field_order`
By default, script variables will be ordered in the form as they are defined in the script. `field_order` may be defined as an iterable of field names to determine the order in which variables are rendered. Any fields not included in this iterable be listed last.
### `commit_default` ### `commit_default`
The checkbox to commit database changes when executing a script is checked by default. Set `commit_default` to False under the script's Meta class to leave this option unchecked by default. The checkbox to commit database changes when executing a script is checked by default. Set `commit_default` to False under the script's Meta class to leave this option unchecked by default.

View File

@ -50,7 +50,7 @@ The `fail()` method may optionally specify a field with which to associate the s
## Assigning Custom Validators ## Assigning Custom Validators
Custom validators are associated with specific NetBox models under the [CUSTOM_VALIDATORS](../configuration/optional-settings.md#custom_validators) configuration parameter. There are three manners by which custom validation rules can be defined: Custom validators are associated with specific NetBox models under the [CUSTOM_VALIDATORS](../configuration/dynamic-settings.md#custom_validators) configuration parameter. There are three manners by which custom validation rules can be defined:
1. Plain JSON mapping (no custom logic) 1. Plain JSON mapping (no custom logic)
2. Dotted path to a custom validator class 2. Dotted path to a custom validator class

View File

@ -122,22 +122,22 @@ The demo data is provided in JSON format and loaded into an empty database using
## Running Tests ## Running Tests
Prior to committing any substantial changes to the code base, be sure to run NetBox's test suite to catch any potential errors. Tests are run using the `test` management command. Remember to ensure the Python virtual environment is active before running this command. Prior to committing any substantial changes to the code base, be sure to run NetBox's test suite to catch any potential errors. Tests are run using the `test` management command. Remember to ensure the Python virtual environment is active before running this command. Also keep in mind that these commands are executed in the `/netbox/` directory, not the root directory of the repository.
```no-highlight ```no-highlight
$ python netbox/manage.py test $ python manage.py test
``` ```
In cases where you haven't made any changes to the database (which is most of the time), you can append the `--keepdb` argument to this command to reuse the test database between runs. This cuts down on the time it takes to run the test suite since the database doesn't have to be rebuilt each time. (Note that this argument will cause errors if you've modified any model fields since the previous test run.) In cases where you haven't made any changes to the database (which is most of the time), you can append the `--keepdb` argument to this command to reuse the test database between runs. This cuts down on the time it takes to run the test suite since the database doesn't have to be rebuilt each time. (Note that this argument will cause errors if you've modified any model fields since the previous test run.)
```no-highlight ```no-highlight
$ python netbox/manage.py test --keepdb $ python manage.py test --keepdb
``` ```
You can also limit the command to running only a specific subset of tests. For example, to run only IPAM and DCIM view tests: You can also limit the command to running only a specific subset of tests. For example, to run only IPAM and DCIM view tests:
```no-highlight ```no-highlight
$ python netbox/manage.py test dcim.tests.test_views ipam.tests.test_views $ python manage.py test dcim.tests.test_views ipam.tests.test_views
``` ```
## Submitting Pull Requests ## Submitting Pull Requests

View File

@ -67,4 +67,4 @@ Authorization: Token $TOKEN
## Disabling the GraphQL API ## Disabling the GraphQL API
If not needed, the GraphQL API can be disabled by setting the [`GRAPHQL_ENABLED`](../configuration/optional-settings.md#graphql_enabled) configuration parameter to False and restarting NetBox. If not needed, the GraphQL API can be disabled by setting the [`GRAPHQL_ENABLED`](../configuration/dynamic-settings.md#graphql_enabled) configuration parameter to False and restarting NetBox.

View File

@ -81,16 +81,3 @@ If no body template is specified, the request body will be populated with a JSON
} }
} }
``` ```
## Conditional Webhooks
A webhook may include a set of conditional logic expressed in JSON used to control whether a webhook triggers for a specific object. For example, you may wish to trigger a webhook for devices only when the `status` field of an object is "active":
```json
{
"attr": "status",
"value": "active"
}
```
For more detail, see the reference documentation for NetBox's [conditional logic](../reference/conditions.md).

432
docs/plugins/development.md Normal file
View File

@ -0,0 +1,432 @@
# Plugin Development
!!! info "Help Improve the NetBox Plugins Framework!"
We're looking for volunteers to help improve NetBox's plugins framework. If you have experience developing plugins, we'd love to hear from you! You can find more information about this initiative [here](https://github.com/netbox-community/netbox/discussions/8338).
This documentation covers the development of custom plugins for NetBox. Plugins are essentially self-contained [Django apps](https://docs.djangoproject.com/en/stable/) which integrate with NetBox to provide custom functionality. Since the development of Django apps is already very well-documented, we'll only be covering the aspects that are specific to NetBox.
Plugins can do a lot, including:
* Create Django models to store data in the database
* Provide their own "pages" (views) in the web user interface
* Inject template content and navigation links
* Establish their own REST API endpoints
* Add custom request/response middleware
However, keep in mind that each piece of functionality is entirely optional. For example, if your plugin merely adds a piece of middleware or an API endpoint for existing data, there's no need to define any new models.
!!! warning
While very powerful, the NetBox plugins API is necessarily limited in its scope. The plugins API is discussed here in its entirety: Any part of the NetBox code base not documented here is _not_ part of the supported plugins API, and should not be employed by a plugin. Internal elements of NetBox are subject to change at any time and without warning. Plugin authors are **strongly** encouraged to develop plugins using only the officially supported components discussed here and those provided by the underlying Django framework so as to avoid breaking changes in future releases.
## Initial Setup
### Plugin Structure
Although the specific structure of a plugin is largely left to the discretion of its authors, a typical NetBox plugin looks something like this:
```no-highlight
project-name/
- plugin_name/
- templates/
- plugin_name/
- *.html
- __init__.py
- middleware.py
- navigation.py
- signals.py
- template_content.py
- urls.py
- views.py
- README
- setup.py
```
The top level is the project root, which can have any name that you like. Immediately within the root should exist several items:
* `setup.py` - This is a standard installation script used to install the plugin package within the Python environment.
* `README` - A brief introduction to your plugin, how to install and configure it, where to find help, and any other pertinent information. It is recommended to write README files using a markup language such as Markdown.
* The plugin source directory, with the same name as your plugin. This must be a valid Python package name (e.g. no spaces or hyphens).
The plugin source directory contains all the actual Python code and other resources used by your plugin. Its structure is left to the author's discretion, however it is recommended to follow best practices as outlined in the [Django documentation](https://docs.djangoproject.com/en/stable/intro/reusable-apps/). At a minimum, this directory **must** contain an `__init__.py` file containing an instance of NetBox's `PluginConfig` class.
### Create setup.py
`setup.py` is the [setup script](https://docs.python.org/3.7/distutils/setupscript.html) we'll use to install our plugin once it's finished. The primary function of this script is to call the setuptools library's `setup()` function to create a Python distribution package. We can pass a number of keyword arguments to inform the package creation as well as to provide metadata about the plugin. An example `setup.py` is below:
```python
from setuptools import find_packages, setup
setup(
name='netbox-animal-sounds',
version='0.1',
description='An example NetBox plugin',
url='https://github.com/netbox-community/netbox-animal-sounds',
author='Jeremy Stretch',
license='Apache 2.0',
install_requires=[],
packages=find_packages(),
include_package_data=True,
zip_safe=False,
)
```
Many of these are self-explanatory, but for more information, see the [setuptools documentation](https://setuptools.readthedocs.io/en/latest/setuptools.html).
!!! note
`zip_safe=False` is **required** as the current plugin iteration is not zip safe due to upstream python issue [issue19699](https://bugs.python.org/issue19699)
### Define a PluginConfig
The `PluginConfig` class is a NetBox-specific wrapper around Django's built-in [`AppConfig`](https://docs.djangoproject.com/en/stable/ref/applications/) class. It is used to declare NetBox plugin functionality within a Python package. Each plugin should provide its own subclass, defining its name, metadata, and default and required configuration parameters. An example is below:
```python
from extras.plugins import PluginConfig
class AnimalSoundsConfig(PluginConfig):
name = 'netbox_animal_sounds'
verbose_name = 'Animal Sounds'
description = 'An example plugin for development purposes'
version = '0.1'
author = 'Jeremy Stretch'
author_email = 'author@example.com'
base_url = 'animal-sounds'
required_settings = []
default_settings = {
'loud': False
}
config = AnimalSoundsConfig
```
NetBox looks for the `config` variable within a plugin's `__init__.py` to load its configuration. Typically, this will be set to the PluginConfig subclass, but you may wish to dynamically generate a PluginConfig class based on environment variables or other factors.
#### PluginConfig Attributes
| Name | Description |
| ---- | ----------- |
| `name` | Raw plugin name; same as the plugin's source directory |
| `verbose_name` | Human-friendly name for the plugin |
| `version` | Current release ([semantic versioning](https://semver.org/) is encouraged) |
| `description` | Brief description of the plugin's purpose |
| `author` | Name of plugin's author |
| `author_email` | Author's public email address |
| `base_url` | Base path to use for plugin URLs (optional). If not specified, the project's `name` will be used. |
| `required_settings` | A list of any configuration parameters that **must** be defined by the user |
| `default_settings` | A dictionary of configuration parameters and their default values |
| `min_version` | Minimum version of NetBox with which the plugin is compatible |
| `max_version` | Maximum version of NetBox with which the plugin is compatible |
| `middleware` | A list of middleware classes to append after NetBox's build-in middleware |
| `template_extensions` | The dotted path to the list of template extension classes (default: `template_content.template_extensions`) |
| `menu_items` | The dotted path to the list of menu items provided by the plugin (default: `navigation.menu_items`) |
All required settings must be configured by the user. If a configuration parameter is listed in both `required_settings` and `default_settings`, the default setting will be ignored.
### Create a Virtual Environment
It is strongly recommended to create a Python [virtual environment](https://docs.python.org/3/tutorial/venv.html) specific to your plugin. This will afford you complete control over the installed versions of all dependencies and avoid conflicting with any system packages. This environment can live wherever you'd like, however it should be excluded from revision control. (A popular convention is to keep all virtual environments in the user's home directory, e.g. `~/.virtualenvs/`.)
```shell
python3 -m venv /path/to/my/venv
```
You can make NetBox available within this environment by creating a path file pointing to its location. This will add NetBox to the Python path upon activation. (Be sure to adjust the command below to specify your actual virtual environment path, Python version, and NetBox installation.)
```shell
cd $VENV/lib/python3.7/site-packages/
echo /opt/netbox/netbox > netbox.pth
```
### Install the Plugin for Development
To ease development, it is recommended to go ahead and install the plugin at this point using setuptools' `develop` mode. This will create symbolic links within your Python environment to the plugin development directory. Call `setup.py` from the plugin's root directory with the `develop` argument (instead of `install`):
```no-highlight
$ python setup.py develop
```
## Database Models
If your plugin introduces a new type of object in NetBox, you'll probably want to create a [Django model](https://docs.djangoproject.com/en/stable/topics/db/models/) for it. A model is essentially a Python representation of a database table, with attributes that represent individual columns. Model instances can be created, manipulated, and deleted using [queries](https://docs.djangoproject.com/en/stable/topics/db/queries/). Models must be defined within a file named `models.py`.
Below is an example `models.py` file containing a model with two character fields:
```python
from django.db import models
class Animal(models.Model):
name = models.CharField(max_length=50)
sound = models.CharField(max_length=50)
def __str__(self):
return self.name
```
Once you have defined the model(s) for your plugin, you'll need to create the database schema migrations. A migration file is essentially a set of instructions for manipulating the PostgreSQL database to support your new model, or to alter existing models. Creating migrations can usually be done automatically using Django's `makemigrations` management command.
!!! note
A plugin must be installed before it can be used with Django management commands. If you skipped this step above, run `python setup.py develop` from the plugin's root directory.
```no-highlight
$ ./manage.py makemigrations netbox_animal_sounds
Migrations for 'netbox_animal_sounds':
/home/jstretch/animal_sounds/netbox_animal_sounds/migrations/0001_initial.py
- Create model Animal
```
Next, we can apply the migration to the database with the `migrate` command:
```no-highlight
$ ./manage.py migrate netbox_animal_sounds
Operations to perform:
Apply all migrations: netbox_animal_sounds
Running migrations:
Applying netbox_animal_sounds.0001_initial... OK
```
For more background on schema migrations, see the [Django documentation](https://docs.djangoproject.com/en/stable/topics/migrations/).
### Using the Django Admin Interface
Plugins can optionally expose their models via Django's built-in [administrative interface](https://docs.djangoproject.com/en/stable/ref/contrib/admin/). This can greatly improve troubleshooting ability, particularly during development. To expose a model, simply register it using Django's `admin.register()` function. An example `admin.py` file for the above model is shown below:
```python
from django.contrib import admin
from .models import Animal
@admin.register(Animal)
class AnimalAdmin(admin.ModelAdmin):
list_display = ('name', 'sound')
```
This will display the plugin and its model in the admin UI. Staff users can create, change, and delete model instances via the admin UI without needing to create a custom view.
![NetBox plugin in the admin UI](../media/plugins/plugin_admin_ui.png)
## Views
If your plugin needs its own page or pages in the NetBox web UI, you'll need to define views. A view is a particular page tied to a URL within NetBox, which renders content using a template. Views are typically defined in `views.py`, and URL patterns in `urls.py`. As an example, let's write a view which displays a random animal and the sound it makes. First, we'll create the view in `views.py`:
```python
from django.shortcuts import render
from django.views.generic import View
from .models import Animal
class RandomAnimalView(View):
"""
Display a randomly-selected animal.
"""
def get(self, request):
animal = Animal.objects.order_by('?').first()
return render(request, 'netbox_animal_sounds/animal.html', {
'animal': animal,
})
```
This view retrieves a random animal from the database and and passes it as a context variable when rendering a template named `animal.html`, which doesn't exist yet. To create this template, first create a directory named `templates/netbox_animal_sounds/` within the plugin source directory. (We use the plugin's name as a subdirectory to guard against naming collisions with other plugins.) Then, create a template named `animal.html` as described below.
### Extending the Base Template
NetBox provides a base template to ensure a consistent user experience, which plugins can extend with their own content. This template includes four content blocks:
* `title` - The page title
* `header` - The upper portion of the page
* `content` - The main page body
* `javascript` - A section at the end of the page for including Javascript code
For more information on how template blocks work, consult the [Django documentation](https://docs.djangoproject.com/en/stable/ref/templates/builtins/#block).
```jinja2
{% extends 'base/layout.html' %}
{% block content %}
{% with config=settings.PLUGINS_CONFIG.netbox_animal_sounds %}
<h2 class="text-center" style="margin-top: 200px">
{% if animal %}
The {{ animal.name|lower }} says
{% if config.loud %}
{{ animal.sound|upper }}!
{% else %}
{{ animal.sound }}
{% endif %}
{% else %}
No animals have been created yet!
{% endif %}
</h2>
{% endwith %}
{% endblock %}
```
The first line of the template instructs Django to extend the NetBox base template and inject our custom content within its `content` block.
!!! note
Django renders templates with its own custom [template language](https://docs.djangoproject.com/en/stable/topics/templates/#the-django-template-language). This is very similar to Jinja2, however there are some important differences to be aware of.
Finally, to make the view accessible to users, we need to register a URL for it. We do this in `urls.py` by defining a `urlpatterns` variable containing a list of paths.
```python
from django.urls import path
from . import views
urlpatterns = [
path('random/', views.RandomAnimalView.as_view(), name='random_animal'),
]
```
A URL pattern has three components:
* `route` - The unique portion of the URL dedicated to this view
* `view` - The view itself
* `name` - A short name used to identify the URL path internally
This makes our view accessible at the URL `/plugins/animal-sounds/random/`. (Remember, our `AnimalSoundsConfig` class sets our plugin's base URL to `animal-sounds`.) Viewing this URL should show the base NetBox template with our custom content inside it.
## REST API Endpoints
Plugins can declare custom endpoints on NetBox's REST API to retrieve or manipulate models or other data. These behave very similarly to views, except that instead of rendering arbitrary content using a template, data is returned in JSON format using a serializer. NetBox uses the [Django REST Framework](https://www.django-rest-framework.org/), which makes writing API serializers and views very simple.
First, we'll create a serializer for our `Animal` model, in `api/serializers.py`:
```python
from rest_framework.serializers import ModelSerializer
from netbox_animal_sounds.models import Animal
class AnimalSerializer(ModelSerializer):
class Meta:
model = Animal
fields = ('id', 'name', 'sound')
```
Next, we'll create a generic API view set that allows basic CRUD (create, read, update, and delete) operations for Animal instances. This is defined in `api/views.py`:
```python
from rest_framework.viewsets import ModelViewSet
from netbox_animal_sounds.models import Animal
from .serializers import AnimalSerializer
class AnimalViewSet(ModelViewSet):
queryset = Animal.objects.all()
serializer_class = AnimalSerializer
```
Finally, we'll register a URL for our endpoint in `api/urls.py`. This file **must** define a variable named `urlpatterns`.
```python
from rest_framework import routers
from .views import AnimalViewSet
router = routers.DefaultRouter()
router.register('animals', AnimalViewSet)
urlpatterns = router.urls
```
With these three components in place, we can request `/api/plugins/animal-sounds/animals/` to retrieve a list of all Animal objects defined.
![NetBox REST API plugin endpoint](../media/plugins/plugin_rest_api_endpoint.png)
!!! warning
This example is provided as a minimal reference implementation only. It does not address authentication, performance, or myriad other concerns that plugin authors should have.
## Navigation Menu Items
To make its views easily accessible to users, a plugin can inject items in NetBox's navigation menu under the "Plugins" header. Menu items are added by defining a list of PluginMenuItem instances. By default, this should be a variable named `menu_items` in the file `navigation.py`. An example is shown below.
```python
from extras.plugins import PluginMenuButton, PluginMenuItem
from utilities.choices import ButtonColorChoices
menu_items = (
PluginMenuItem(
link='plugins:netbox_animal_sounds:random_animal',
link_text='Random sound',
buttons=(
PluginMenuButton('home', 'Button A', 'fa fa-info', ButtonColorChoices.BLUE),
PluginMenuButton('home', 'Button B', 'fa fa-warning', ButtonColorChoices.GREEN),
)
),
)
```
A `PluginMenuItem` has the following attributes:
* `link` - The name of the URL path to which this menu item links
* `link_text` - The text presented to the user
* `permissions` - A list of permissions required to display this link (optional)
* `buttons` - An iterable of PluginMenuButton instances to display (optional)
A `PluginMenuButton` has the following attributes:
* `link` - The name of the URL path to which this button links
* `title` - The tooltip text (displayed when the mouse hovers over the button)
* `icon_class` - Button icon CSS class (NetBox currently supports [Font Awesome 4.7](https://fontawesome.com/v4.7.0/icons/))
* `color` - One of the choices provided by `ButtonColorChoices` (optional)
* `permissions` - A list of permissions required to display this button (optional)
!!! note
Any buttons associated within a menu item will be shown only if the user has permission to view the link, regardless of what permissions are set on the buttons.
## Extending Core Templates
Plugins can inject custom content into certain areas of the detail views of applicable models. This is accomplished by subclassing `PluginTemplateExtension`, designating a particular NetBox model, and defining the desired methods to render custom content. Four methods are available:
* `left_page()` - Inject content on the left side of the page
* `right_page()` - Inject content on the right side of the page
* `full_width_page()` - Inject content across the entire bottom of the page
* `buttons()` - Add buttons to the top of the page
Additionally, a `render()` method is available for convenience. This method accepts the name of a template to render, and any additional context data you want to pass. Its use is optional, however.
When a PluginTemplateExtension is instantiated, context data is assigned to `self.context`. Available data include:
* `object` - The object being viewed
* `request` - The current request
* `settings` - Global NetBox settings
* `config` - Plugin-specific configuration parameters
For example, accessing `{{ request.user }}` within a template will return the current user.
Declared subclasses should be gathered into a list or tuple for integration with NetBox. By default, NetBox looks for an iterable named `template_extensions` within a `template_content.py` file. (This can be overridden by setting `template_extensions` to a custom value on the plugin's PluginConfig.) An example is below.
```python
from extras.plugins import PluginTemplateExtension
from .models import Animal
class SiteAnimalCount(PluginTemplateExtension):
model = 'dcim.site'
def right_page(self):
return self.render('netbox_animal_sounds/inc/animal_count.html', extra_context={
'animal_count': Animal.objects.count(),
})
template_extensions = [SiteAnimalCount]
```
## Background Tasks
By default, Netbox provides 3 differents [RQ](https://python-rq.org/) queues to run background jobs : *high*, *default* and *low*.
These 3 core queues can be used out-of-the-box by plugins to define background tasks.
Plugins can also define dedicated queues. These queues can be configured under the PluginConfig class `queues` attribute. An example configuration
is below:
```python
class MyPluginConfig(PluginConfig):
name = 'myplugin'
...
queues = [
'queue1',
'queue2',
'queue-whatever-the-name'
]
```
The PluginConfig above creates 3 queues with the following names: *myplugin.queue1*, *myplugin.queue2*, *myplugin.queue-whatever-the-name*.
As you can see, the queue's name is always preprended with the plugin's name, to avoid any name clashes between different plugins.
In case you create dedicated queues for your plugin, it is strongly advised to also create a dedicated RQ worker instance. This instance should only listen to the queues defined in your plugin - to avoid impact between your background tasks and netbox internal tasks.
```
python manage.py rqworker myplugin.queue1 myplugin.queue2 myplugin.queue-whatever-the-name
```

View File

@ -81,13 +81,16 @@ The following condition will evaluate as true:
```json ```json
{ {
"attr": "status", "attr": "status.value",
"value": ["planned", "staging"], "value": ["planned", "staging"],
"op": "in", "op": "in",
"negate": true "negate": true
} }
``` ```
!!! note "Evaluating static choice fields"
Pay close attention when evaluating static choice fields, such as the `status` field above. These fields typically render as a dictionary specifying both the field's raw value (`value`) and its human-friendly label (`label`). be sure to specify on which of these you want to match.
## Condition Sets ## Condition Sets
Multiple conditions can be combined into nested sets using AND or OR logic. This is done by declaring a JSON object with a single key (`and` or `or`) containing a list of condition objects and/or child condition sets. Multiple conditions can be combined into nested sets using AND or OR logic. This is done by declaring a JSON object with a single key (`and` or `or`) containing a list of condition objects and/or child condition sets.
@ -102,7 +105,7 @@ Multiple conditions can be combined into nested sets using AND or OR logic. This
{ {
"and": [ "and": [
{ {
"attr": "status", "attr": "status.value",
"value": "active" "value": "active"
}, },
{ {

View File

@ -367,7 +367,7 @@ More information about IP ranges is available [in the documentation](../models/i
#### Custom Model Validation ([#5963](https://github.com/netbox-community/netbox/issues/5963)) #### Custom Model Validation ([#5963](https://github.com/netbox-community/netbox/issues/5963))
This release introduces the [`CUSTOM_VALIDATORS`](../configuration/optional-settings.md#custom_validators) configuration parameter, which allows administrators to map NetBox models to custom validator classes to enforce custom validation logic. For example, the following configuration requires every site to have a name of at least ten characters and a description: This release introduces the [`CUSTOM_VALIDATORS`](../configuration/dynamic-settings.md#custom_validators) configuration parameter, which allows administrators to map NetBox models to custom validator classes to enforce custom validation logic. For example, the following configuration requires every site to have a name of at least ten characters and a description:
```python ```python
from extras.validators import CustomValidator from extras.validators import CustomValidator

View File

@ -1,6 +1,35 @@
# NetBox v3.1 # NetBox v3.1
<<<<<<< HEAD
## v3.1.7 (FUTURE) ## v3.1.7 (FUTURE)
=======
## v3.1.7 (2022-02-03)
### Enhancements
* [#7504](https://github.com/netbox-community/netbox/issues/7504) - Include IP range data under IPAM role views
* [#8275](https://github.com/netbox-community/netbox/issues/8275) - Introduce alternative ASDOT-formatted column for ASNs
* [#8367](https://github.com/netbox-community/netbox/issues/8367) - Add ASNs to global search function
* [#8368](https://github.com/netbox-community/netbox/issues/8368) - Enable controlling the order of custom script form fields with `field_order`
* [#8381](https://github.com/netbox-community/netbox/issues/8381) - Add contacts to global search function
* [#8462](https://github.com/netbox-community/netbox/issues/8462) - Linkify manufacturer column in device type table
* [#8476](https://github.com/netbox-community/netbox/issues/8476) - Bring the ASN Web UI up to the standard set by other objects
* [#8494](https://github.com/netbox-community/netbox/issues/8494) - Include locations count under tenant view
* [#8517](https://github.com/netbox-community/netbox/issues/8517) - Render boolean custom fields as icons in object tables
* [#8530](https://github.com/netbox-community/netbox/issues/8530) - Indicate CSV or YAML as format for "all data" export
### Bug Fixes
* [#8315](https://github.com/netbox-community/netbox/issues/8315) - Fix display of NAT link for primary IPv4 address under device view
* [#8377](https://github.com/netbox-community/netbox/issues/8377) - Fix calculation of absolute cable lengths when specified in fractional units
* [#8425](https://github.com/netbox-community/netbox/issues/8425) - Fix exception when viewing change list/records with removed plugins
* [#8456](https://github.com/netbox-community/netbox/issues/8456) - Fix redundant display of VRF RD in prefix view
* [#8465](https://github.com/netbox-community/netbox/issues/8465) - Accept empty string values for Interface `rf_channel` in REST API
* [#8498](https://github.com/netbox-community/netbox/issues/8498) - Fix display of selected content type filters in object list views
* [#8499](https://github.com/netbox-community/netbox/issues/8499) - Content types REST API endpoint should not require model permission
* [#8512](https://github.com/netbox-community/netbox/issues/8512) - Correct file permissions to allow execution of housekeeping script
* [#8527](https://github.com/netbox-community/netbox/issues/8527) - Fix display of changelog retention period
>>>>>>> develop
--- ---

View File

@ -723,7 +723,7 @@ class InterfaceSerializer(PrimaryModelSerializer, LinkTerminationSerializer, Con
mode = ChoiceField(choices=InterfaceModeChoices, allow_blank=True, required=False) mode = ChoiceField(choices=InterfaceModeChoices, allow_blank=True, required=False)
duplex = ChoiceField(choices=InterfaceDuplexChoices, allow_blank=True, required=False) duplex = ChoiceField(choices=InterfaceDuplexChoices, allow_blank=True, required=False)
rf_role = ChoiceField(choices=WirelessRoleChoices, required=False, allow_null=True) rf_role = ChoiceField(choices=WirelessRoleChoices, required=False, allow_null=True)
rf_channel = ChoiceField(choices=WirelessChannelChoices, required=False) rf_channel = ChoiceField(choices=WirelessChannelChoices, required=False, allow_blank=True)
untagged_vlan = NestedVLANSerializer(required=False, allow_null=True) untagged_vlan = NestedVLANSerializer(required=False, allow_null=True)
tagged_vlans = SerializedPKRelatedField( tagged_vlans = SerializedPKRelatedField(
queryset=VLAN.objects.all(), queryset=VLAN.objects.all(),

View File

@ -0,0 +1,31 @@
from django.db import migrations
from utilities.utils import to_meters
def recalculate_abs_length(apps, schema_editor):
"""
Recalculate absolute lengths for all cables with a length and length unit defined. Fixes
incorrectly calculated values as reported under bug #8377.
"""
Cable = apps.get_model('dcim', 'Cable')
cables = Cable.objects.filter(length__isnull=False).exclude(length_unit='')
for cable in cables:
cable._abs_length = to_meters(cable.length, cable.length_unit)
Cable.objects.bulk_update(cables, ['_abs_length'], batch_size=100)
class Migration(migrations.Migration):
dependencies = [
('dcim', '0143_remove_primary_for_related_name'),
]
operations = [
migrations.RunPython(
code=recalculate_abs_length,
reverse_code=migrations.RunPython.noop
),
]

View File

@ -4,7 +4,7 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('dcim', '0143_remove_primary_for_related_name'), ('dcim', '0144_fix_cable_abs_length'),
] ]
operations = [ operations = [

View File

@ -10,7 +10,7 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('extras', '0066_customfield_name_validation'), ('extras', '0066_customfield_name_validation'),
('dcim', '0144_site_remove_deprecated_fields'), ('dcim', '0145_site_remove_deprecated_fields'),
] ]
operations = [ operations = [

View File

@ -9,7 +9,7 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('extras', '0068_configcontext_cluster_types'), ('extras', '0068_configcontext_cluster_types'),
('dcim', '0145_modules'), ('dcim', '0146_modules'),
] ]
operations = [ operations = [

View File

@ -6,7 +6,7 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('contenttypes', '0002_remove_content_type_name'), ('contenttypes', '0002_remove_content_type_name'),
('dcim', '0146_inventoryitemrole'), ('dcim', '0147_inventoryitemrole'),
] ]
operations = [ operations = [

View File

@ -9,7 +9,7 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('contenttypes', '0002_remove_content_type_name'), ('contenttypes', '0002_remove_content_type_name'),
('dcim', '0147_inventoryitem_component'), ('dcim', '0148_inventoryitem_component'),
] ]
operations = [ operations = [

View File

@ -8,7 +8,7 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('ipam', '0054_vlangroup_min_max_vids'), ('ipam', '0054_vlangroup_min_max_vids'),
('dcim', '0148_inventoryitem_templates'), ('dcim', '0149_inventoryitem_templates'),
] ]
operations = [ operations = [

View File

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('dcim', '0149_interface_vrf'), ('dcim', '0150_interface_vrf'),
] ]
operations = [ operations = [

View File

@ -4,7 +4,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('dcim', '0150_interface_speed_duplex'), ('dcim', '0151_interface_speed_duplex'),
] ]
operations = [ operations = [

View File

@ -44,7 +44,7 @@ class CableTable(NetBoxTable):
tenant = TenantColumn() tenant = TenantColumn()
length = columns.TemplateColumn( length = columns.TemplateColumn(
template_code=CABLE_LENGTH, template_code=CABLE_LENGTH,
order_by='_abs_length' order_by=('_abs_length', 'length_unit')
) )
color = columns.ColorColumn() color = columns.ColorColumn()
tags = columns.TagColumn( tags = columns.TagColumn(

View File

@ -268,7 +268,7 @@ class CableTerminationTable(NetBoxTable):
linkify=True linkify=True
) )
cable_color = columns.ColorColumn( cable_color = columns.ColorColumn(
accessor='cable.color', accessor='cable__color',
orderable=False, orderable=False,
verbose_name='Cable Color' verbose_name='Cable Color'
) )
@ -283,7 +283,7 @@ class CableTerminationTable(NetBoxTable):
class PathEndpointTable(CableTerminationTable): class PathEndpointTable(CableTerminationTable):
connection = columns.TemplateColumn( connection = columns.TemplateColumn(
accessor='_path.last_node', accessor='_path__last_node',
template_code=LINKTERMINATION, template_code=LINKTERMINATION,
verbose_name='Connection', verbose_name='Connection',
orderable=False orderable=False

View File

@ -66,6 +66,9 @@ class DeviceTypeTable(NetBoxTable):
linkify=True, linkify=True,
verbose_name='Device Type' verbose_name='Device Type'
) )
manufacturer = tables.Column(
linkify=True
)
is_full_depth = columns.BooleanColumn( is_full_depth = columns.BooleanColumn(
verbose_name='Full Depth' verbose_name='Full Depth'
) )

View File

@ -79,7 +79,7 @@ class SiteTable(NetBoxTable):
linkify=True linkify=True
) )
asn_count = columns.LinkedCountColumn( asn_count = columns.LinkedCountColumn(
accessor=tables.A('asns.count'), accessor=tables.A('asns__count'),
viewname='ipam:asn_list', viewname='ipam:asn_list',
url_params={'site_id': 'pk'}, url_params={'site_id': 'pk'},
verbose_name='ASNs' verbose_name='ASNs'

View File

@ -9,7 +9,8 @@ LINKTERMINATION = """
""" """
CABLE_LENGTH = """ CABLE_LENGTH = """
{% if record.length %}{{ record.length }} {{ record.get_length_unit_display }}{% endif %} {% load helpers %}
{% if record.length %}{{ record.length|simplify_decimal }} {{ record.length_unit }}{% endif %}
""" """
CABLE_TERMINATION_PARENT = """ CABLE_TERMINATION_PARENT = """

View File

@ -9,6 +9,7 @@ from dcim.models import *
from ipam.models import ASN, RIR, VLAN, VRF from ipam.models import ASN, RIR, VLAN, VRF
from utilities.testing import APITestCase, APIViewTestCases, create_test_device from utilities.testing import APITestCase, APIViewTestCases, create_test_device
from virtualization.models import Cluster, ClusterType from virtualization.models import Cluster, ClusterType
from wireless.choices import WirelessChannelChoices
from wireless.models import WirelessLAN from wireless.models import WirelessLAN
@ -1437,13 +1438,11 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
'name': 'Interface 4', 'name': 'Interface 4',
'type': '1000base-t', 'type': '1000base-t',
'mode': InterfaceModeChoices.MODE_TAGGED, 'mode': InterfaceModeChoices.MODE_TAGGED,
'tx_power': 10, 'speed': 1000000,
'duplex': 'full',
'vrf': vrfs[0].pk, 'vrf': vrfs[0].pk,
'tagged_vlans': [vlans[0].pk, vlans[1].pk], 'tagged_vlans': [vlans[0].pk, vlans[1].pk],
'untagged_vlan': vlans[2].pk, 'untagged_vlan': vlans[2].pk,
'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk],
'speed': 1000000,
'duplex': 'full'
}, },
{ {
'device': device.pk, 'device': device.pk,
@ -1451,13 +1450,11 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
'type': '1000base-t', 'type': '1000base-t',
'mode': InterfaceModeChoices.MODE_TAGGED, 'mode': InterfaceModeChoices.MODE_TAGGED,
'bridge': interfaces[0].pk, 'bridge': interfaces[0].pk,
'tx_power': 10, 'speed': 100000,
'duplex': 'half',
'vrf': vrfs[1].pk, 'vrf': vrfs[1].pk,
'tagged_vlans': [vlans[0].pk, vlans[1].pk], 'tagged_vlans': [vlans[0].pk, vlans[1].pk],
'untagged_vlan': vlans[2].pk, 'untagged_vlan': vlans[2].pk,
'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk],
'speed': 100000,
'duplex': 'half'
}, },
{ {
'device': device.pk, 'device': device.pk,
@ -1465,11 +1462,25 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
'type': 'virtual', 'type': 'virtual',
'mode': InterfaceModeChoices.MODE_TAGGED, 'mode': InterfaceModeChoices.MODE_TAGGED,
'parent': interfaces[1].pk, 'parent': interfaces[1].pk,
'tx_power': 10,
'vrf': vrfs[2].pk, 'vrf': vrfs[2].pk,
'tagged_vlans': [vlans[0].pk, vlans[1].pk], 'tagged_vlans': [vlans[0].pk, vlans[1].pk],
'untagged_vlan': vlans[2].pk, 'untagged_vlan': vlans[2].pk,
},
{
'device': device.pk,
'name': 'Interface 7',
'type': InterfaceTypeChoices.TYPE_80211A,
'tx_power': 10,
'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk], 'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk],
'rf_channel': WirelessChannelChoices.CHANNEL_5G_32,
},
{
'device': device.pk,
'name': 'Interface 8',
'type': InterfaceTypeChoices.TYPE_80211A,
'tx_power': 10,
'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk],
'rf_channel': "",
}, },
] ]

View File

@ -4,6 +4,7 @@ from django_rq.queues import get_connection
from rest_framework import status from rest_framework import status
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied from rest_framework.exceptions import PermissionDenied
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.routers import APIRootView from rest_framework.routers import APIRootView
from rest_framework.viewsets import ReadOnlyModelViewSet, ViewSet from rest_framework.viewsets import ReadOnlyModelViewSet, ViewSet
@ -382,6 +383,7 @@ class ContentTypeViewSet(ReadOnlyModelViewSet):
""" """
Read-only list of ContentTypes. Limit results to ContentTypes pertinent to NetBox objects. Read-only list of ContentTypes. Limit results to ContentTypes pertinent to NetBox objects.
""" """
permission_classes = (IsAuthenticated,)
queryset = ContentType.objects.order_by('app_label', 'model') queryset = ContentType.objects.order_by('app_label', 'model')
serializer_class = serializers.ContentTypeSerializer serializer_class = serializers.ContentTypeSerializer
filterset_class = filtersets.ContentTypeFilterSet filterset_class = filtersets.ContentTypeFilterSet

View File

@ -43,7 +43,7 @@ class CustomLinkBulkEditForm(BulkEditForm):
) )
content_type = ContentTypeChoiceField( content_type = ContentTypeChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'), limit_choices_to=FeatureQuery('custom_links'),
required=False required=False
) )
enabled = forms.NullBooleanField( enabled = forms.NullBooleanField(
@ -71,7 +71,7 @@ class ExportTemplateBulkEditForm(BulkEditForm):
) )
content_type = ContentTypeChoiceField( content_type = ContentTypeChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'), limit_choices_to=FeatureQuery('export_templates'),
required=False required=False
) )
description = forms.CharField( description = forms.CharField(

View File

@ -61,7 +61,7 @@ class CustomLinkFilterForm(FilterForm):
) )
content_type = ContentTypeChoiceField( content_type = ContentTypeChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'), limit_choices_to=FeatureQuery('custom_links'),
required=False required=False
) )
enabled = forms.NullBooleanField( enabled = forms.NullBooleanField(
@ -88,7 +88,7 @@ class ExportTemplateFilterForm(FilterForm):
) )
content_type = ContentTypeChoiceField( content_type = ContentTypeChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'), limit_choices_to=FeatureQuery('export_templates'),
required=False required=False
) )
mime_type = forms.CharField( mime_type = forms.CharField(
@ -114,7 +114,7 @@ class WebhookFilterForm(FilterForm):
) )
content_types = ContentTypeMultipleChoiceField( content_types = ContentTypeMultipleChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'), limit_choices_to=FeatureQuery('webhooks'),
required=False required=False
) )
http_method = forms.MultipleChoiceField( http_method = forms.MultipleChoiceField(

View File

@ -296,12 +296,21 @@ class BaseScript:
@classmethod @classmethod
def _get_vars(cls): def _get_vars(cls):
vars = OrderedDict() vars = {}
for name, attr in cls.__dict__.items(): for name, attr in cls.__dict__.items():
if name not in vars and issubclass(attr.__class__, ScriptVariable): if name not in vars and issubclass(attr.__class__, ScriptVariable):
vars[name] = attr vars[name] = attr
return vars # Order variables according to field_order
field_order = getattr(cls.Meta, 'field_order', None)
if not field_order:
return vars
ordered_vars = {
field: vars.pop(field) for field in field_order if field in vars
}
ordered_vars.update(vars)
return ordered_vars
def run(self, data, commit): def run(self, data, commit):
raise NotImplementedError("The script must define a run() method.") raise NotImplementedError("The script must define a run() method.")

View File

@ -27,7 +27,7 @@ CONFIGCONTEXT_ACTIONS = """
""" """
OBJECTCHANGE_OBJECT = """ OBJECTCHANGE_OBJECT = """
{% if record.changed_object.get_absolute_url %} {% if record.changed_object and record.changed_object.get_absolute_url %}
<a href="{{ record.changed_object.get_absolute_url }}">{{ record.object_repr }}</a> <a href="{{ record.changed_object.get_absolute_url }}">{{ record.object_repr }}</a>
{% else %} {% else %}
{{ record.object_repr }} {{ record.object_repr }}

View File

@ -615,7 +615,6 @@ class CreatedUpdatedFilterTest(APITestCase):
class ContentTypeTest(APITestCase): class ContentTypeTest(APITestCase):
@override_settings(EXEMPT_VIEW_PERMISSIONS=['contenttypes.contenttype'])
def test_list_objects(self): def test_list_objects(self):
contenttype_count = ContentType.objects.count() contenttype_count = ContentType.objects.count()
@ -623,7 +622,6 @@ class ContentTypeTest(APITestCase):
self.assertHttpStatus(response, status.HTTP_200_OK) self.assertHttpStatus(response, status.HTTP_200_OK)
self.assertEqual(response.data['count'], contenttype_count) self.assertEqual(response.data['count'], contenttype_count)
@override_settings(EXEMPT_VIEW_PERMISSIONS=['contenttypes.contenttype'])
def test_get_object(self): def test_get_object(self):
contenttype = ContentType.objects.first() contenttype = ContentType.objects.first()

View File

@ -205,6 +205,10 @@ class ASNFilterSet(OrganizationalModelFilterSet, TenancyFilterSet):
if not value.strip(): if not value.strip():
return queryset return queryset
qs_filter = Q(description__icontains=value) qs_filter = Q(description__icontains=value)
try:
qs_filter |= Q(asn=int(value))
except ValueError:
pass
return queryset.filter(qs_filter) return queryset.filter(qs_filter)

View File

@ -44,7 +44,7 @@ class FHRPGroupTable(NetBoxTable):
class FHRPGroupAssignmentTable(NetBoxTable): class FHRPGroupAssignmentTable(NetBoxTable):
interface_parent = tables.Column( interface_parent = tables.Column(
accessor=tables.A('interface.parent_object'), accessor=tables.A('interface__parent_object'),
linkify=True, linkify=True,
orderable=False, orderable=False,
verbose_name='Parent' verbose_name='Parent'

View File

@ -104,17 +104,28 @@ class ASNTable(NetBoxTable):
accessor=tables.A('asn_asdot'), accessor=tables.A('asn_asdot'),
linkify=True linkify=True
) )
asn_asdot = tables.Column(
accessor=tables.A('asn_asdot'),
linkify=True,
verbose_name='ASDOT'
)
site_count = columns.LinkedCountColumn( site_count = columns.LinkedCountColumn(
viewname='dcim:site_list', viewname='dcim:site_list',
url_params={'asn_id': 'pk'}, url_params={'asn_id': 'pk'},
verbose_name='Sites' verbose_name='Sites'
) )
tenant = TenantColumn()
tags = columns.TagColumn(
url_name='ipam:asn_list'
)
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
model = ASN model = ASN
fields = ('pk', 'asn', 'rir', 'site_count', 'tenant', 'description', 'created', 'last_updated', 'actions') fields = (
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'tenant') 'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'tenant', 'description', 'created', 'last_updated',
'actions',
)
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'description', 'tenant')
# #
@ -164,6 +175,11 @@ class RoleTable(NetBoxTable):
url_params={'role_id': 'pk'}, url_params={'role_id': 'pk'},
verbose_name='Prefixes' verbose_name='Prefixes'
) )
iprange_count = columns.LinkedCountColumn(
viewname='ipam:iprange_list',
url_params={'role_id': 'pk'},
verbose_name='IP Ranges'
)
vlan_count = columns.LinkedCountColumn( vlan_count = columns.LinkedCountColumn(
viewname='ipam:vlan_list', viewname='ipam:vlan_list',
url_params={'role_id': 'pk'}, url_params={'role_id': 'pk'},
@ -176,10 +192,10 @@ class RoleTable(NetBoxTable):
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
model = Role model = Role
fields = ( fields = (
'pk', 'id', 'name', 'slug', 'prefix_count', 'vlan_count', 'description', 'weight', 'tags', 'created', 'pk', 'id', 'name', 'slug', 'prefix_count', 'iprange_count', 'vlan_count', 'description', 'weight', 'tags',
'last_updated', 'actions', 'created', 'last_updated', 'actions',
) )
default_columns = ('pk', 'name', 'prefix_count', 'vlan_count', 'description') default_columns = ('pk', 'name', 'prefix_count', 'iprange_count', 'vlan_count', 'description')
# #
@ -339,7 +355,7 @@ class IPAddressTable(NetBoxTable):
verbose_name='Interface' verbose_name='Interface'
) )
assigned_object_parent = tables.Column( assigned_object_parent = tables.Column(
accessor='assigned_object.parent_object', accessor='assigned_object__parent_object',
linkify=True, linkify=True,
orderable=False, orderable=False,
verbose_name='Device/VM' verbose_name='Device/VM'

View File

@ -340,6 +340,7 @@ class AggregateBulkDeleteView(generic.BulkDeleteView):
class RoleListView(generic.ObjectListView): class RoleListView(generic.ObjectListView):
queryset = Role.objects.annotate( queryset = Role.objects.annotate(
prefix_count=count_related(Prefix, 'role'), prefix_count=count_related(Prefix, 'role'),
iprange_count=count_related(IPRange, 'role'),
vlan_count=count_related(VLAN, 'role') vlan_count=count_related(VLAN, 'role')
) )
filterset = filtersets.RoleFilterSet filterset = filtersets.RoleFilterSet

View File

@ -12,12 +12,14 @@ from dcim.tables import (
CableTable, DeviceTable, DeviceTypeTable, PowerFeedTable, RackTable, RackReservationTable, LocationTable, SiteTable, CableTable, DeviceTable, DeviceTypeTable, PowerFeedTable, RackTable, RackReservationTable, LocationTable, SiteTable,
VirtualChassisTable, VirtualChassisTable,
) )
from ipam.filtersets import AggregateFilterSet, IPAddressFilterSet, PrefixFilterSet, VLANFilterSet, VRFFilterSet from ipam.filtersets import (
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF AggregateFilterSet, ASNFilterSet, IPAddressFilterSet, PrefixFilterSet, VLANFilterSet, VRFFilterSet,
from ipam.tables import AggregateTable, IPAddressTable, PrefixTable, VLANTable, VRFTable )
from tenancy.filtersets import TenantFilterSet from ipam.models import Aggregate, ASN, IPAddress, Prefix, VLAN, VRF
from tenancy.models import Tenant from ipam.tables import AggregateTable, ASNTable, IPAddressTable, PrefixTable, VLANTable, VRFTable
from tenancy.tables import TenantTable from tenancy.filtersets import ContactFilterSet, TenantFilterSet
from tenancy.models import Contact, Tenant
from tenancy.tables import ContactTable, TenantTable
from utilities.utils import count_related from utilities.utils import count_related
from virtualization.filtersets import ClusterFilterSet, VirtualMachineFilterSet from virtualization.filtersets import ClusterFilterSet, VirtualMachineFilterSet
from virtualization.models import Cluster, VirtualMachine from virtualization.models import Cluster, VirtualMachine
@ -170,6 +172,12 @@ SEARCH_TYPES = OrderedDict((
'table': VLANTable, 'table': VLANTable,
'url': 'ipam:vlan_list', 'url': 'ipam:vlan_list',
}), }),
('asn', {
'queryset': ASN.objects.prefetch_related('rir', 'tenant'),
'filterset': ASNFilterSet,
'table': ASNTable,
'url': 'ipam:asn_list',
}),
# Tenancy # Tenancy
('tenant', { ('tenant', {
'queryset': Tenant.objects.prefetch_related('group'), 'queryset': Tenant.objects.prefetch_related('group'),
@ -177,4 +185,10 @@ SEARCH_TYPES = OrderedDict((
'table': TenantTable, 'table': TenantTable,
'url': 'tenancy:tenant_list', 'url': 'tenancy:tenant_list',
}), }),
('contact', {
'queryset': Contact.objects.prefetch_related('group', 'assignments'),
'filterset': ContactFilterSet,
'table': ContactTable,
'url': 'tenancy:contact_list',
}),
)) ))

View File

@ -320,8 +320,11 @@ class CustomFieldColumn(tables.Column):
def render(self, value): def render(self, value):
if isinstance(value, list): if isinstance(value, list):
return ', '.join(v for v in value) return ', '.join(v for v in value)
elif self.customfield.type == CustomFieldTypeChoices.TYPE_BOOLEAN and value is True:
return mark_safe('<i class="mdi mdi-check-bold text-success"></i>')
elif self.customfield.type == CustomFieldTypeChoices.TYPE_BOOLEAN and value is False:
return mark_safe('<i class="mdi mdi-close-thick text-danger"></i>')
elif self.customfield.type == CustomFieldTypeChoices.TYPE_URL: elif self.customfield.type == CustomFieldTypeChoices.TYPE_URL:
# Linkify custom URLs
return mark_safe(f'<a href="{value}">{value}</a>') return mark_safe(f'<a href="{value}">{value}</a>')
if value is not None: if value is not None:
obj = self.customfield.deserialize(value) obj = self.customfield.deserialize(value)
@ -330,6 +333,13 @@ class CustomFieldColumn(tables.Column):
return obj return obj
return self.default return self.default
def value(self, value):
if isinstance(value, list):
return ','.join(v for v in value)
if value is not None:
return value
return self.default
class CustomLinkColumn(tables.Column): class CustomLinkColumn(tables.Column):
""" """

View File

@ -188,7 +188,7 @@
{% if object.primary_ip4 %} {% if object.primary_ip4 %}
<a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a> <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
{% if object.primary_ip4.nat_inside %} {% if object.primary_ip4.nat_inside %}
(NAT for <a href="{{ object.primary_ip4.nat_inside.get_absolute_url }})">{{ object.primary_ip4.nat_inside.address.ip }}</a>) (NAT for <a href="{{ object.primary_ip4.nat_inside.get_absolute_url }}">{{ object.primary_ip4.nat_inside.address.ip }}</a>)
{% elif object.primary_ip4.nat_outside %} {% elif object.primary_ip4.nat_outside %}
(NAT: <a href="{{ object.primary_ip4.nat_outside.get_absolute_url }}">{{ object.primary_ip4.nat_outside.address.ip }}</a>) (NAT: <a href="{{ object.primary_ip4.nat_outside.get_absolute_url }}">{{ object.primary_ip4.nat_outside.address.ip }}</a>)
{% endif %} {% endif %}

View File

@ -11,7 +11,7 @@
</div> </div>
</div> </div>
<div class="text-muted"> <div class="text-muted">
Change log retention: {% if settings.CHANGELOG_RETENTION %}{{ settings.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %} Change log retention: {% if config.CHANGELOG_RETENTION %}{{ config.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -5,12 +5,14 @@
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li> <li class="breadcrumb-item"><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li>
{% if object.related_object.get_absolute_url %} {% if object.related_object and object.related_object.get_absolute_url %}
<li class="breadcrumb-item"><a href="{{ object.related_object.get_absolute_url }}changelog/">{{ object.related_object }}</a></li> <li class="breadcrumb-item"><a href="{{ object.related_object.get_absolute_url }}changelog/">{{ object.related_object }}</a></li>
{% elif object.changed_object.get_absolute_url %} {% elif object.changed_object and object.changed_object.get_absolute_url %}
<li class="breadcrumb-item"><a href="{{ object.changed_object.get_absolute_url }}changelog/">{{ object.changed_object }}</a></li> <li class="breadcrumb-item"><a href="{{ object.changed_object.get_absolute_url }}changelog/">{{ object.changed_object }}</a></li>
{% elif object.changed_object %} {% elif object.changed_object and object.changed_object.get_display %}
<li class="breadcrumb-item">{{ object.changed_object }}</li> <li class="breadcrumb-item">{{ object.changed_object }}</li>
{% else %}
<li class="breadcrumb-item">{{ object.object_repr }}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
@ -54,7 +56,7 @@
<tr> <tr>
<th scope="row">Object</th> <th scope="row">Object</th>
<td> <td>
{% if object.changed_object.get_absolute_url %} {% if object.changed_object and object.changed_object.get_absolute_url %}
<a href="{{ object.changed_object.get_absolute_url }}">{{ object.changed_object }}</a> <a href="{{ object.changed_object.get_absolute_url }}">{{ object.changed_object }}</a>
{% else %} {% else %}
{{ object.object_repr }} {{ object.object_repr }}

View File

@ -2,8 +2,9 @@
{% block title %}Change Log{% endblock %} {% block title %}Change Log{% endblock %}
{% block sidebar %} {% block content-wrapper %}
<div class="text-muted"> {{ block.super }}
Change log retention: {% if settings.CHANGELOG_RETENTION %}{{ settings.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %} <div class="text-muted px-3">
</div> Change log retention: {% if config.CHANGELOG_RETENTION %}{{ config.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %}
</div>
{% endblock %} {% endblock %}

View File

@ -18,7 +18,7 @@
<th scope="row">VRF</th> <th scope="row">VRF</th>
<td> <td>
{% if object.vrf %} {% if object.vrf %}
<a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a> ({{ object.vrf.rd }}) <a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a>
{% else %} {% else %}
<span>Global</span> <span>Global</span>
{% endif %} {% endif %}

View File

@ -38,6 +38,30 @@
<a href="{% url 'ipam:prefix_list' %}?role_id={{ object.pk }}">{{ prefixes_table.rows|length }}</a> <a href="{% url 'ipam:prefix_list' %}?role_id={{ object.pk }}">{{ prefixes_table.rows|length }}</a>
</td> </td>
</tr> </tr>
<tr>
<th scope="row">IP Ranges</th>
<td>
{% with ipranges_count=object.ip_ranges.count %}
{% if ipranges_count %}
<a href="{% url 'ipam:iprange_list' %}?role_id={{ object.pk }}">{{ ipranges_count }}</a>
{% else %}
&mdash;
{% endif %}
{% endwith %}
</td>
</tr>
<tr>
<th scope="row">VLANs</th>
<td>
{% with vlans_count=object.vlans.count %}
{% if vlans_count %}
<a href="{% url 'ipam:vlan_list' %}?role_id={{ object.pk }}">{{ vlans_count }}</a>
{% else %}
&mdash;
{% endif %}
{% endwith %}
</td>
</tr>
</table> </table>
</div> </div>
</div> </div>

View File

@ -59,6 +59,10 @@
<h2><a href="{% url 'dcim:rackreservation_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.rackreservation_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.rackreservation_count }}</a></h2> <h2><a href="{% url 'dcim:rackreservation_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.rackreservation_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.rackreservation_count }}</a></h2>
<p>Rack reservations</p> <p>Rack reservations</p>
</div> </div>
<div class="col col-md-4 text-center">
<h2><a href="{% url 'dcim:location_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.location_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.location_count }}</a></h2>
<p>Locations</p>
</div>
<div class="col col-md-4 text-center"> <div class="col col-md-4 text-center">
<h2><a href="{% url 'dcim:device_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.device_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.device_count }}</a></h2> <h2><a href="{% url 'dcim:device_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.device_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.device_count }}</a></h2>
<p>Devices</p> <p>Devices</p>
@ -71,6 +75,10 @@
<h2><a href="{% url 'ipam:aggregate_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.aggregate_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.aggregate_count }}</a></h2> <h2><a href="{% url 'ipam:aggregate_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.aggregate_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.aggregate_count }}</a></h2>
<p>Aggregates</p> <p>Aggregates</p>
</div> </div>
<div class="col col-md-4 text-center">
<h2><a href="{% url 'ipam:asn_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.asn_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.asn_count }}</a></h2>
<p>ASNs</p>
</div>
<div class="col col-md-4 text-center"> <div class="col col-md-4 text-center">
<h2><a href="{% url 'ipam:prefix_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.prefix_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2> <h2><a href="{% url 'ipam:prefix_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.prefix_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2>
<p>Prefixes</p> <p>Prefixes</p>

View File

@ -1,10 +1,9 @@
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from circuits.models import Circuit from circuits.models import Circuit
from dcim.models import Site, Rack, Device, RackReservation, Cable from dcim.models import Cable, Device, Location, Rack, RackReservation, Site
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF, ASN
from netbox.views import generic from netbox.views import generic
from netbox.tables import configure_table from netbox.tables import configure_table
from utilities.utils import count_related from utilities.utils import count_related
@ -103,6 +102,7 @@ class TenantView(generic.ObjectView):
'site_count': Site.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'site_count': Site.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'rack_count': Rack.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'rack_count': Rack.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'rackreservation_count': RackReservation.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'rackreservation_count': RackReservation.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'location_count': Location.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
@ -113,6 +113,7 @@ class TenantView(generic.ObjectView):
'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'cable_count': Cable.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'cable_count': Cable.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'asn_count': ASN.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
} }
return { return {

View File

@ -127,12 +127,13 @@ def get_selected_values(form, field_name):
if not hasattr(field, 'choices'): if not hasattr(field, 'choices'):
return [str(filter_data)] return [str(filter_data)]
# Get choice labels # Model choice field
if type(field.choices) is forms.models.ModelChoiceIterator: if type(field.choices) is forms.models.ModelChoiceIterator:
# Field uses dynamic choices: show all that have been populated on the widget # If this is a single-choice field, wrap its value in a list
values = [ if not hasattr(filter_data, '__iter__'):
subwidget.choice_label for subwidget in form[field_name].subwidgets values = [filter_data]
] else:
values = filter_data
else: else:
# Static selection field # Static selection field

View File

@ -1,31 +1,31 @@
<div class="dropdown"> <div class="dropdown">
<button type="button" class="btn btn-sm btn-purple dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-sm btn-purple dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-download"></i>&nbsp;Export <i class="mdi mdi-download"></i>&nbsp;Export
</button> </button>
<ul class="dropdown-menu dropdown-menu-end"> <ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params.urlencode }}&{% endif %}export=table">Current View</a></li> <li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export=table">Current View</a></li>
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params.urlencode }}&{% endif %}export">All Data</a></li> <li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export">All Data ({{ data_format }})</a></li>
{% if export_templates %} {% if export_templates %}
<li>
<hr class="dropdown-divider">
</li>
{% for et in export_templates %}
<li> <li>
<hr class="dropdown-divider"> <a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export={{ et.name }}"
</li> {% if et.description %} title="{{ et.description }}"{% endif %}
{% for et in export_templates %} >
<li>
<a class="dropdown-item"
href="?{% if url_params %}{{ url_params.urlencode }}&{% endif %}export={{ et.name }}"{% if et.description %}
title="{{ et.description }}"{% endif %}>
{{ et.name }} {{ et.name }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if add_exporttemplate_link %} {% if perms.extras.add_exporttemplate %}
<li> <li>
<hr class="dropdown-divider"> <hr class="dropdown-divider">
</li> </li>
<li> <li>
<a class="dropdown-item" href="{{ add_exporttemplate_link }}">Add export template...</a> <a class="dropdown-item" href="{% url 'extras:exporttemplate_add' %}?content_type={{ content_type.pk }}">Add export template...</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>

View File

@ -81,19 +81,19 @@ def import_button(url):
@register.inclusion_tag('buttons/export.html', takes_context=True) @register.inclusion_tag('buttons/export.html', takes_context=True)
def export_button(context, content_type=None): def export_button(context, content_type):
add_exporttemplate_link = None user = context['request'].user
if content_type is not None: # Determine if the "all data" export returns CSV or YAML
user = context['request'].user data_format = 'YAML' if hasattr(content_type.model_class(), 'to_yaml') else 'CSV'
export_templates = ExportTemplate.objects.restrict(user, 'view').filter(content_type=content_type)
if user.is_staff and user.has_perm('extras.add_exporttemplate'): # Retrieve all export templates for this model
add_exporttemplate_link = f"{reverse('extras:exporttemplate_add')}?content_type={content_type.pk}" export_templates = ExportTemplate.objects.restrict(user, 'view').filter(content_type=content_type)
else:
export_templates = []
return { return {
'url_params': context['request'].GET, 'perms': context['perms'],
'content_type': content_type,
'url_params': context['request'].GET.urlencode() if context['request'].GET else '',
'export_templates': export_templates, 'export_templates': export_templates,
'add_exporttemplate_link': add_exporttemplate_link, 'data_format': data_format,
} }

View File

@ -1,9 +1,8 @@
import datetime import datetime
import json import json
import urllib
from collections import OrderedDict from collections import OrderedDict
from decimal import Decimal
from itertools import count, groupby from itertools import count, groupby
from typing import Any, Dict, List, Tuple
from django.core.serializers import serialize from django.core.serializers import serialize
from django.db.models import Count, OuterRef, Subquery from django.db.models import Count, OuterRef, Subquery
@ -205,15 +204,15 @@ def to_meters(length, unit):
""" """
Convert the given length to meters. Convert the given length to meters.
""" """
length = int(length) try:
if length < 0: if length < 0:
raise ValueError("Length must be a positive integer") raise ValueError("Length must be a positive number")
except TypeError:
raise TypeError(f"Invalid value '{length}' for length (must be a number)")
valid_units = CableLengthUnitChoices.values() valid_units = CableLengthUnitChoices.values()
if unit not in valid_units: if unit not in valid_units:
raise ValueError( raise ValueError(f"Unknown unit {unit}. Must be one of the following: {', '.join(valid_units)}")
"Unknown unit {}. Must be one of the following: {}".format(unit, ', '.join(valid_units))
)
if unit == CableLengthUnitChoices.UNIT_KILOMETER: if unit == CableLengthUnitChoices.UNIT_KILOMETER:
return length * 1000 return length * 1000
@ -222,11 +221,11 @@ def to_meters(length, unit):
if unit == CableLengthUnitChoices.UNIT_CENTIMETER: if unit == CableLengthUnitChoices.UNIT_CENTIMETER:
return length / 100 return length / 100
if unit == CableLengthUnitChoices.UNIT_MILE: if unit == CableLengthUnitChoices.UNIT_MILE:
return length * 1609.344 return length * Decimal(1609.344)
if unit == CableLengthUnitChoices.UNIT_FOOT: if unit == CableLengthUnitChoices.UNIT_FOOT:
return length * 0.3048 return length * Decimal(0.3048)
if unit == CableLengthUnitChoices.UNIT_INCH: if unit == CableLengthUnitChoices.UNIT_INCH:
return length * 0.3048 * 12 return length * Decimal(0.3048) * 12
raise ValueError(f"Unknown unit {unit}. Must be 'km', 'm', 'cm', 'mi', 'ft', or 'in'.") raise ValueError(f"Unknown unit {unit}. Must be 'km', 'm', 'cm', 'mi', 'ft', or 'in'.")

View File

@ -1,4 +1,4 @@
Django==3.2.11 Django==3.2.12
django-cors-headers==3.11.0 django-cors-headers==3.11.0
django-debug-toolbar==3.2.4 django-debug-toolbar==3.2.4
django-filter==21.1 django-filter==21.1
@ -18,16 +18,16 @@ gunicorn==20.1.0
Jinja2==3.0.3 Jinja2==3.0.3
Markdown==3.3.6 Markdown==3.3.6
markdown-include==0.6.0 markdown-include==0.6.0
mkdocs-material==8.1.7 mkdocs-material==8.1.9
mkdocstrings==0.17.0 mkdocstrings==0.17.0
netaddr==0.8.0 netaddr==0.8.0
Pillow==8.4.0 Pillow==8.4.0
psycopg2-binary==2.9.3 psycopg2-binary==2.9.3
PyYAML==6.0 PyYAML==6.0
social-auth-app-django==5.0.0 social-auth-app-django==5.0.0
social-auth-core==4.1.0 social-auth-core==4.2.0
svgwrite==1.4.1 svgwrite==1.4.1
tablib==3.1.0 tablib==3.2.0
# Workaround for #7401 # Workaround for #7401
jsonschema==3.2.0 jsonschema==3.2.0