mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Merge pull request #3813 from hSaria/3812-optimize-select-api
Fixes #3812: Only preload selected options for API-based select
This commit is contained in:
commit
fc5d07bb13
@ -8,6 +8,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
|
||||
|
||||
|
@ -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(s); new options are dynamically displayed and added via the API
|
||||
template_name = 'widgets/select_api.html'
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
5
netbox/utilities/templates/widgets/select_api.html
Normal file
5
netbox/utilities/templates/widgets/select_api.html
Normal file
@ -0,0 +1,5 @@
|
||||
<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
|
||||
<optgroup label="{{ group_name }}">{% endif %}{% for widget in group_choices %}{% if widget.attrs.selected %}
|
||||
{% include widget.template_name %}{% endif %}{% endfor %}{% if group_name %}
|
||||
</optgroup>{% endif %}{% endfor %}
|
||||
</select>
|
Loading…
Reference in New Issue
Block a user