Skip to main content

Netbox plugin to manage attachments for any model

Project description

NetBox Attachments Plugin

NetBox plugin for attaching files to any model.

Features

This plugin provides the following model:

  • NetBoxAttachment: A model for attaching files to any NetBox object.

Compatibility

The following table shows the compatibility between different NetBox versions and plugin versions:

NetBox Version Plugin Version
>= 3.3.4 0.0.0 - 0.0.5
>= 3.4.0 0.0.6 - 1.0.6
>= 3.4.3 1.0.7 - 1.1.x
>= 3.5.0 2.0.0
>= 3.6.0 3.0.0
>= 3.7.0 4.0.0
>= 4.0.0 5.x.x
>= 4.1.0 6.x.x

Installation

The plugin is available as a Python package on PyPI and can be installed with pip:

pip install netbox-attachments

To enable the plugin, add it to the PLUGINS list in your configuration.py:

PLUGINS = ['netbox_attachments']

Next, create a directory for storing attachments and set the appropriate permissions:

mkdir -p /opt/netbox/netbox/media/netbox-attachments
chown netbox /opt/netbox/netbox/media/netbox-attachments

Run the database migrations for the plugin:

python3 manage.py migrate netbox_attachments

Restart NetBox and ensure that netbox-attachments is included in your local_requirements.txt.

For more details, see the NetBox Documentation.

Configuration

Plugin Options

The plugin can be customized using the following configuration options:

  • apps:

    • Type: List
    • Default: ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless']
    • Description: Specify the app labels where the Attachments feature should be enabled. Attachments are displayed on the right_page of the detail view of the models.
  • display_default:

    • Type: String
    • Default: "additional_tab"
    • Options: "left_page", "right_page", "full_width_page", "additional_tab"
    • Description: Sets the default location where attachments should be displayed in the models.
  • display_setting:

    • Type: Dictionary
    • Default: {}
    • Format: {<app_label.model>: <preferred_display>}
    • Example: {'dcim.devicerole': 'full_width_page', 'dcim.device': 'left_page', 'ipam.vlan': 'additional_tab'}
    • Description: Override the display settings for specific models.
    • Tip: Use the correct app_label and model names, which can be found in the API at <your_netbox_url>/api/extras/content-types/.

Warning: The additional_tab option does not work for plugin models.

Configuration Example

Here is an example of how to configure the plugin in configuration.py:

PLUGINS_CONFIG = {
    'netbox_attachments': {
        'apps': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless', 'inventory_monitor'],
        'display_default': "right_page",
        'display_setting': {
            'ipam.vlan': "left_page",
            'dcim.device': "full_width_page",
            'dcim.devicerole': "full_width_page",
            'inventory_monitor.probe': "additional_tab"
        }
    }
}

Enabling Attachments for Custom Plugins (Models)

To enable attachments for custom plugin models:

  1. Append your plugin to the apps configuration list:

    apps: ['<plugin_name>']
    
  2. Extend the detail templates of your plugin models:

    {% load plugins %}  # At the top of the template
    
    {% plugin_right_page object %}  # Under the comments section
    
    # Add left_page and full_width for future extensions
    

Example (Device Model)

Screenshots

  • Model View: Platform attachments

  • List View: List View

  • Detail View: Detail View

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_attachments-6.0.0b1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

netbox_attachments-6.0.0b1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file netbox_attachments-6.0.0b1.tar.gz.

File metadata

  • Download URL: netbox_attachments-6.0.0b1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for netbox_attachments-6.0.0b1.tar.gz
Algorithm Hash digest
SHA256 cbec7ec1e2c35eb2a2ab68260c591d118868f691e8ca3362b3df265f369063bb
MD5 40fb1768a233681856daa17747cd698c
BLAKE2b-256 7eeb6fb0280ae253a725f3235a791b92d0e51b8e12dd5ebdcf7149d4eeaa3f1c

See more details on using hashes here.

File details

Details for the file netbox_attachments-6.0.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_attachments-6.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 3442088d209ee2b7d5925c1db8b444abce4f68f5deca023cb94dd8fdf5610653
MD5 0976f2e651c3db20c42eb744a7a75b50
BLAKE2b-256 197d19c334731ad257f9f63189fd232e28e5f8beb3de630abd297fd9183d8975

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page