# NetBox Attachments Plugin
[NetBox](https://github.com/netbox-community/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`:
```sh
pip install netbox-attachments
```
To enable the plugin, add it to the `PLUGINS` list in your `configuration.py`:
```python
PLUGINS = ['netbox_attachments']
```
Next, create a directory for storing attachments and set the appropriate permissions:
```sh
mkdir -p /opt/netbox/netbox/media/netbox-attachments
chown netbox /opt/netbox/netbox/media/netbox-attachments
```
Run the database migrations for the plugin:
```sh
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](https://docs.netbox.dev/en/stable/plugins/#installing-plugins).
## 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`:
```python
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:
```python
apps: ['<plugin_name>']
```
2. Extend the detail templates of your plugin models:
```django
{% 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)
- [load](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L6)
- [left_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L149)
- [right_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L288)
- [full_width_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L293)
## Screenshots
- **Model View:**
![Platform attachments](docs/img/platform.png)
- **List View:**
![List View](docs/img/list.PNG)
- **Detail View:**
![Detail View](docs/img/detail.PNG)
Raw data
{
"_id": null,
"home_page": "https://github.com/Kani999/netbox-attachments",
"name": "netbox-attachments",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "netbox, netbox-plugin",
"author": "Jan Krupa",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/68/b6/0baac2bae01e12dda52b51c6e1efacdf03c084669a3f7ab9122e1d8c6b32/netbox_attachments-6.0.0.tar.gz",
"platform": null,
"description": "# NetBox Attachments Plugin\n\n[NetBox](https://github.com/netbox-community/netbox) plugin for attaching files to any model.\n\n## Features\n\nThis plugin provides the following model:\n\n- **NetBoxAttachment**: A model for attaching files to any NetBox object.\n\n## Compatibility\n\nThe following table shows the compatibility between different NetBox versions and plugin versions:\n\n| NetBox Version | Plugin Version |\n| -------------- | ------------------ |\n| >= 3.3.4 | 0.0.0 - 0.0.5 |\n| >= 3.4.0 | 0.0.6 - 1.0.6 |\n| >= 3.4.3 | 1.0.7 - 1.1.x |\n| >= 3.5.0 | 2.0.0 |\n| >= 3.6.0 | 3.0.0 |\n| >= 3.7.0 | 4.0.0 |\n| >= 4.0.0 | 5.x.x |\n| >= 4.1.0 | 6.x.x\n\n## Installation\n\nThe plugin is available as a Python package on PyPI and can be installed with `pip`:\n\n```sh\npip install netbox-attachments\n```\n\nTo enable the plugin, add it to the `PLUGINS` list in your `configuration.py`:\n\n```python\nPLUGINS = ['netbox_attachments']\n```\n\nNext, create a directory for storing attachments and set the appropriate permissions:\n\n```sh\nmkdir -p /opt/netbox/netbox/media/netbox-attachments\nchown netbox /opt/netbox/netbox/media/netbox-attachments\n```\n\nRun the database migrations for the plugin:\n\n```sh\npython3 manage.py migrate netbox_attachments\n```\n\nRestart NetBox and ensure that `netbox-attachments` is included in your `local_requirements.txt`.\n\nFor more details, see the [NetBox Documentation](https://docs.netbox.dev/en/stable/plugins/#installing-plugins).\n\n## Configuration\n\n### Plugin Options\n\nThe plugin can be customized using the following configuration options:\n\n- `apps`:\n - **Type**: List\n - **Default**: `['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless']`\n - **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.\n\n- `display_default`:\n - **Type**: String\n - **Default**: `\"additional_tab\"`\n - **Options**: `\"left_page\"`, `\"right_page\"`, `\"full_width_page\"`, `\"additional_tab\"`\n - **Description**: Sets the default location where attachments should be displayed in the models.\n\n- `display_setting`:\n - **Type**: Dictionary\n - **Default**: `{}`\n - **Format**: `{<app_label.model>: <preferred_display>}`\n - **Example**: `{'dcim.devicerole': 'full_width_page', 'dcim.device': 'left_page', 'ipam.vlan': 'additional_tab'}`\n - **Description**: Override the display settings for specific models.\n - **Tip**: Use the correct `app_label` and `model` names, which can be found in the API at `<your_netbox_url>/api/extras/content-types/`.\n\n> **Warning**: The `additional_tab` option does not work for plugin models.\n\n### Configuration Example\n\nHere is an example of how to configure the plugin in `configuration.py`:\n\n```python\nPLUGINS_CONFIG = {\n 'netbox_attachments': {\n 'apps': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless', 'inventory_monitor'],\n 'display_default': \"right_page\",\n 'display_setting': {\n 'ipam.vlan': \"left_page\",\n 'dcim.device': \"full_width_page\",\n 'dcim.devicerole': \"full_width_page\",\n 'inventory_monitor.probe': \"additional_tab\"\n }\n }\n}\n```\n\n## Enabling Attachments for Custom Plugins (Models)\n\nTo enable attachments for custom plugin models:\n\n1. Append your plugin to the `apps` configuration list:\n\n ```python\n apps: ['<plugin_name>']\n ```\n\n2. Extend the detail templates of your plugin models:\n\n ```django\n {% load plugins %} # At the top of the template\n \n {% plugin_right_page object %} # Under the comments section\n \n # Add left_page and full_width for future extensions\n ```\n\n### Example (Device Model)\n\n- [load](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L6)\n- [left_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L149)\n- [right_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L288)\n- [full_width_page](https://github.com/netbox-community/netbox/blob/c1b7f09530f0293d0f053b8930539b1d174cd03b/netbox/templates/dcim/device.html#L293)\n\n## Screenshots\n\n- **Model View:**\n ![Platform attachments](docs/img/platform.png)\n \n- **List View:**\n ![List View](docs/img/list.PNG)\n \n- **Detail View:**\n ![Detail View](docs/img/detail.PNG)\n",
"bugtrack_url": null,
"license": "Apache 2",
"summary": "Netbox plugin to manage attachments for any model",
"version": "6.0.0",
"project_urls": {
"Homepage": "https://github.com/Kani999/netbox-attachments"
},
"split_keywords": [
"netbox",
" netbox-plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d022da3783832dcf989d2defd0189e5cf919f4a1169bce942f3746e730f0c5c4",
"md5": "952d26dc53bfa77d384279247d5a6510",
"sha256": "2f3de78f48a724b763f53eed13182c67490d284146e3ba41f7f7a912314e1437"
},
"downloads": -1,
"filename": "netbox_attachments-6.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "952d26dc53bfa77d384279247d5a6510",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 24867,
"upload_time": "2024-09-09T12:38:30",
"upload_time_iso_8601": "2024-09-09T12:38:30.212583Z",
"url": "https://files.pythonhosted.org/packages/d0/22/da3783832dcf989d2defd0189e5cf919f4a1169bce942f3746e730f0c5c4/netbox_attachments-6.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "68b60baac2bae01e12dda52b51c6e1efacdf03c084669a3f7ab9122e1d8c6b32",
"md5": "e6db3a4290302d4cab5e258247b5ff0f",
"sha256": "33d01cabaf924a4c9799a783728efcb974fe474a76ee347878ee7af7b25a0788"
},
"downloads": -1,
"filename": "netbox_attachments-6.0.0.tar.gz",
"has_sig": false,
"md5_digest": "e6db3a4290302d4cab5e258247b5ff0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 17924,
"upload_time": "2024-09-09T12:38:31",
"upload_time_iso_8601": "2024-09-09T12:38:31.693024Z",
"url": "https://files.pythonhosted.org/packages/68/b6/0baac2bae01e12dda52b51c6e1efacdf03c084669a3f7ab9122e1d8c6b32/netbox_attachments-6.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 12:38:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Kani999",
"github_project": "netbox-attachments",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "netbox-attachments"
}