Releases: Kani999/netbox-attachments
8.0.4
7.2.0
Release 7.2.0
What's Changed:
- Add model validation on save by @Omripresent in PR #82
- 📝 Add docstrings to
model_validation_on_save
by @coderabbitai in PR #83 - Add model validation on save by @Kani999 in PR #84
New Contributors:
- @Omripresent made their first contribution in PR #82
- @coderabbitai made their first contribution in PR #83
Enhancements:
- Introduced model-level validation to ensure attachments are only created for permitted object types. Attempting to attach to an unpermitted model will raise a
ValidationError
. - Added a new validation function
validate_object_type
used across forms and models to enforce attachment permissions. - Updated the README with a new badge and additional documentation for the validation checks.
Technical Changes:
- Forms:
- Added
_validate_object_type
method to theNetBoxAttachmentForm
to validate object types during form cleaning.
- Added
- Models:
- Enhanced
NetBoxAttachment
model with validation logic in thesave
method to ensure only permitted models can have attachments. - Improved deletion method to preserve original filenames post-deletion.
- Enhanced
- Utilities:
- Added
validate_object_type
function to determine eligible models for attachments based on plugin settings. - Added
choice_default
utility function to handle default values for settings.
- Added
- Template Content:
- Updated to use the new
validate_object_type
function to dynamically generate template extensions for eligible models.
- Updated to use the new
Full Changelog: 7.1.0...7.2.0
This release introduces significant validation improvements to ensure that attachments are only created for permitted models, enhancing the overall security and integrity of the plugin.
7.1.0
What's Changed
Breaking Changes: NetBox Attachments v7.1.0
Configuration System Addition
Summary
Version 7.1.0 introduces new configuration options that provide more granular control over which models should have attachment functionality enabled.
Changed: Plugin Settings Structure
Before (7.0.0)
PLUGINS_CONFIG = {
'netbox_attachments': {
'apps': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless'],
'display_default': "additional_tab",
'display_setting': {
'ipam.vlan': "left_page"
}
}
}
After (v7.1.0)
PLUGINS_CONFIG = {
'netbox_attachments': {
'applied_scope': 'app', # New setting: 'app' or 'model'
'scope_filter': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless'],
'display_default': "additional_tab",
'create_add_button': True, # New setting
'display_setting': {
'ipam.vlan': "left_page"
}
}
}
New Features and Functionality
The configuration system has been enhanced with two primary new settings:
-
applied_scope
: Determines how attachments are filtered/enabled across NetBox modelsapp
: Enables attachments for all models within specified apps (similar to previous behavior)model
: Enables attachments only for specific models or all models within selected apps
-
scope_filter
: Replaces the previousapps
setting with expanded functionality- When
applied_scope="app"
: Works like the previousapps
setting - When
applied_scope="model"
: Can include:- Specific model identifiers (e.g., 'dcim.device')
- App labels (e.g., 'tenancy') to include all models from that app
- When
-
create_add_button
: Controls whether an "Add Attachment" button appears in parent views- Specific to the
additional_tab
display setting
- Specific to the
Migration Guide
To migrate from the previous configuration to the new format:
-
If you want to maintain your current behavior (attachments available for all models in specified apps):
# Old configuration 'apps': ['dcim', 'ipam', 'circuits'] # New configuration 'applied_scope': 'app', 'scope_filter': ['dcim', 'ipam', 'circuits']
-
If you want more granular control over which specific models have attachments:
# New configuration with specific models 'applied_scope': 'model', 'scope_filter': [ 'dcim.device', 'ipam.prefix', # Specific models 'tenancy', # All models from this app ]
-
The new
create_add_button
setting defaults toTrue
but can be set toFalse
if you don't want the add button to appear.
Technical Impact
- The configuration validation now includes checks for the new settings
- The model filtering logic has been enhanced to support both app-level and model-level filtering
- Documentation has been updated to reflect these new options
- The default settings include backward-compatible values
Backwards Compatibility
This change is designed to be backward compatible when using the default settings. If your configuration specifies only apps
, the plugin will automatically adapt to use applied_scope="app"
and scope_filter
instead of apps
.
However, for optimal performance and clarity, it's recommended to update your configuration to explicitly use the new format.
Full Changelog: 7.0.1...7.1.0
7.0.1
7.0.0
What's Changed
- Enables installation for NetBox 4.2
- Version Bump for NetBox 4.2 by @goebelmeier in #76
New Contributors
- @goebelmeier made their first contribution in #76
Full Changelog: 6.0.0...7.0.0
6.0.0
6.0.0-b1
5.1.4-b1
- Add
remove_orphaned_netbox_attachments
command tomanage.py
- Scan and deletes
netbox-attachments
folder for files without assigned existing object
Full Changelog: 5.1.3...5.1.4-b1
5.1.3
What's Changed
- Modify templates to more NetBox natural look by @Kani999 in #69
- Fix dissapearing search button in additional tab
- Attachment panel rendered by htmx_table instead of custom template
- Change size of Add Attachment button
Full Changelog: 5.1.1...5.1.3
5.1.2-b2
- Revert get_children
Full Changelog: 5.1.2-b1...5.1.2-b2