mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge pull request #8925 from kkthxbye-code/fast_script_list
Fix #8924 - Speed up rendering of the script list
This commit is contained in:
@ -259,6 +259,10 @@ class BaseScript:
|
|||||||
Base model for custom scripts. User classes should inherit from this model if they want to extend Script
|
Base model for custom scripts. User classes should inherit from this model if they want to extend Script
|
||||||
functionality for use in other subclasses.
|
functionality for use in other subclasses.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Prevent django from instantiating the class on all accesses
|
||||||
|
do_not_call_in_templates = True
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -280,7 +284,7 @@ class BaseScript:
|
|||||||
|
|
||||||
@classproperty
|
@classproperty
|
||||||
def name(self):
|
def name(self):
|
||||||
return getattr(self.Meta, 'name', self.__class__.__name__)
|
return getattr(self.Meta, 'name', self.__name__)
|
||||||
|
|
||||||
@classproperty
|
@classproperty
|
||||||
def full_name(self):
|
def full_name(self):
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
{% for class_name, script in module_scripts.items %}
|
{% for class_name, script in module_scripts.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}">{{ script }}</a>
|
<a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}">{{ script.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% include 'extras/inc/job_label.html' with result=script.result %}
|
{% include 'extras/inc/job_label.html' with result=script.result %}
|
||||||
|
Reference in New Issue
Block a user