From 53625e0deabd807e324d8478d9e535c54eec19f3 Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Wed, 1 Jan 2020 15:54:00 +0000 Subject: [PATCH 1/2] Fixes #3812: Only preload selected options for API-based select --- docs/release-notes/version-2.6.md | 1 + netbox/utilities/forms.py | 2 ++ netbox/utilities/templates/widgets/select_api.html | 5 +++++ 3 files changed, 8 insertions(+) create mode 100644 netbox/utilities/templates/widgets/select_api.html diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 548492438..a3bd9336a 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -5,6 +5,7 @@ * [#3705](https://github.com/netbox-community/netbox/issues/3705) - Provide request context when executing custom scripts * [#3762](https://github.com/netbox-community/netbox/issues/3762) - Add date/time picker widgets * [#3788](https://github.com/netbox-community/netbox/issues/3788) - Enable partial search for inventory items +* [#3812](https://github.com/netbox-community/netbox/issues/3812) - Optimize size of pages containing a dynamic selection field ## Bug Fixes diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 44d76186d..baac01e4b 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -285,6 +285,8 @@ class APISelect(SelectWithDisabled): name of the query param and the value if the query param's value. :param null_option: If true, include the static null option in the selection list. """ + # Only preload the selected option; new options are dynamically displayed and added via the API + template_name = 'widgets/select_api.html' def __init__( self, diff --git a/netbox/utilities/templates/widgets/select_api.html b/netbox/utilities/templates/widgets/select_api.html new file mode 100644 index 000000000..0146a31ff --- /dev/null +++ b/netbox/utilities/templates/widgets/select_api.html @@ -0,0 +1,5 @@ + From 242ae9eb91de3756fe20fa0e68f1c8c0442f08dc Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Wed, 1 Jan 2020 16:04:08 +0000 Subject: [PATCH 2/2] Comment clarification --- netbox/utilities/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index baac01e4b..eeee719ae 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -285,7 +285,7 @@ class APISelect(SelectWithDisabled): name of the query param and the value if the query param's value. :param null_option: If true, include the static null option in the selection list. """ - # Only preload the selected option; new options are dynamically displayed and added via the API + # Only preload the selected option(s); new options are dynamically displayed and added via the API template_name = 'widgets/select_api.html' def __init__(