From 016eff52c013980cf88f85f22d82caf0535cc16f Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 13 Mar 2023 11:59:57 -0400 Subject: [PATCH 01/60] PRVB --- docs/release-notes/version-3.4.md | 4 ++++ netbox/netbox/settings.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.4.md b/docs/release-notes/version-3.4.md index 43f4dab5e3c..d754123c6de 100644 --- a/docs/release-notes/version-3.4.md +++ b/docs/release-notes/version-3.4.md @@ -1,5 +1,9 @@ # NetBox v3.4 +## v3.4.7 (FUTURE) + +--- + ## v3.4.6 (2023-03-13) ### Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index c8730364975..45fe3284104 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -24,7 +24,7 @@ # Environment setup # -VERSION = '3.4.6' +VERSION = '3.4.7-dev' # Hostname HOSTNAME = platform.node() From 4286d74d4468b2da24af1be7021ca35f943fbe6b Mon Sep 17 00:00:00 2001 From: Ryan Merolle Date: Tue, 14 Mar 2023 15:50:49 -0400 Subject: [PATCH 02/60] Add fieldsets functionality to scripts to allow for form field groupings (#11880) * update script template * update docs * introduce default_fieldset * correct custom script docs * default to use fieldsets in scripts * update scripts docs for new behavior * Misc cleanup --------- Co-authored-by: jeremystretch --- docs/customization/custom-scripts.md | 19 +++++++++++++++++-- netbox/extras/scripts.py | 12 ++++++++++++ netbox/templates/extras/script.html | 26 ++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index af1e9b5b697..ccbe5088535 100644 --- a/docs/customization/custom-scripts.md +++ b/docs/customization/custom-scripts.md @@ -79,7 +79,22 @@ 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. +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 within a default "Script Data" group. Any fields not included in this iterable be listed last. If `fieldsets` is defined, `field_order` will be ignored. A fieldset group for "Script Execution Parameters" will be added to the end of the form by default for the user. + +### `fieldsets` + +`fieldsets` may be defined as an iterable of field groups and their field names to determine the order in which variables are group and rendered. Any fields not included in this iterable will not be displayed in the form. If `fieldsets` is defined, `field_order` will be ignored. A fieldset group for "Script Execution Parameters" will be added to the end of the fieldsets by default for the user. + +An example fieldset definition is provided below: + +```python +class MyScript(Script): + class Meta: + fieldsets = ( + ('First group', ('field1', 'field2', 'field3')), + ('Second group', ('field4', 'field5')), + ) +``` ### `commit_default` @@ -302,7 +317,7 @@ Optionally `schedule_at` can be passed in the form data with a datetime string t Scripts can be run on the CLI by invoking the management command: ``` -python3 manage.py runscript [--commit] [--loglevel {debug,info,warning,error,critical}] [--data ""] .