-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Only preload selected options for APISelect widgets #3812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Comments
This was referenced Jan 1, 2020
Thanks for capturing this. It's something I've been wanting to address for a while now. |
jeremystretch
added a commit
that referenced
this issue
Jan 2, 2020
Fixes #3812: Only preload selected options for API-based select
Merged
jeremystretch
added a commit
that referenced
this issue
Jan 3, 2020
Merged
kobayashi
pushed a commit
to kobayashi/netbox
that referenced
this issue
Jan 5, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Proposed Changes
Change
APISelect
andAPISelectMultiple
to only preload the selected fields.Justification
The current implementation for
APISelect
andAPISelectMultiple
preloads all of the objects of the model. Even though paging of size 50 is performed on the API calls, the page will load with all of the objects, even ignoring whatAPISelect
might be filtering out.For example, all of the roles (11 through 99) are loaded in the device creation page. The APISelect itself paginates correctly, but I presume the default behavior of Django's
forms.Select
is making it so all of the options are loaded (not 100% sure about the last part).By preventing those options from being loaded, the pages that use the
APISelect
and/orAPISelectMultiple
would load faster due to smaller pages.It should be noted that selected options must be loaded in order for them to be rendered on the form. It's only the options that aren't selected which can be omitted as they are created dynamically when selected.
The text was updated successfully, but these errors were encountered: