[PR #8925] [MERGED] Fix #8924 - Speed up rendering of the script list #13410

Closed
opened 2025-12-29 22:27:15 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/8925
Author: @kkthxbye-code
Created: 3/21/2022
Status: Merged
Merged: 3/23/2022
Merged by: @jeremystretch

Base: developHead: fast_script_list


📝 Commits (2)

  • 22980ce Speed up rendering of the script list
  • ae46cd3 - Move do_not_call_in_templates to BaseScript

📊 Changes

2 files changed (+6 additions, -2 deletions)

View changed files

📝 netbox/extras/scripts.py (+5 -1)
📝 netbox/templates/extras/script_list.html (+1 -1)

📄 Description

Fixes: #8924

Loading the script list can become slow when having multiple large scripts. The reason is that django instantiates the Script class for each access in the template. This can be very slow in some cases.

The fix is simply to set do_not_call_in_templates = True on the callable before passing them to the template. Please let me know if there is a better option.

The template was changed slightly, as the script variable did not return the name when not instantiated. Name is now taken from Meta instead.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/8925 **Author:** [@kkthxbye-code](https://github.com/kkthxbye-code) **Created:** 3/21/2022 **Status:** ✅ Merged **Merged:** 3/23/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `fast_script_list` --- ### 📝 Commits (2) - [`22980ce`](https://github.com/netbox-community/netbox/commit/22980cea7ba264b42f1a119235e6928e5c8f5f40) Speed up rendering of the script list - [`ae46cd3`](https://github.com/netbox-community/netbox/commit/ae46cd33b633d9248e38a68ea11e896e35eb3400) - Move do_not_call_in_templates to BaseScript ### 📊 Changes **2 files changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/scripts.py` (+5 -1) 📝 `netbox/templates/extras/script_list.html` (+1 -1) </details> ### 📄 Description ### Fixes: #8924 Loading the script list can become slow when having multiple large scripts. The reason is that django instantiates the Script class for each access in the template. This can be very slow in some cases. The fix is simply to set `do_not_call_in_templates` = True on the callable before passing them to the template. Please let me know if there is a better option. The template was changed slightly, as the script variable did not return the name when not instantiated. Name is now taken from Meta instead. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:27:15 +01:00
adam closed this issue 2025-12-29 22:27:15 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13410