mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fixes #18738: Ensure ScriptList respects script_order option
This commit is contained in:
parent
be26f86b62
commit
39a96ddf3a
@ -117,6 +117,15 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||
def __str__(self):
|
||||
return self.python_name
|
||||
|
||||
@property
|
||||
def ordered_scripts(self):
|
||||
script_objects = {s.name: s for s in self.scripts.all()}
|
||||
ordered = [
|
||||
script_objects.pop(sc) for sc in self.module_scripts.keys() if sc in script_objects
|
||||
]
|
||||
ordered.extend(script_objects.items())
|
||||
return ordered
|
||||
|
||||
@property
|
||||
def module_scripts(self):
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</h2>
|
||||
{% with scripts=module.scripts.all %}
|
||||
{% with scripts=module.ordered_scripts %}
|
||||
{% if scripts %}
|
||||
<table class="table table-hover scripts">
|
||||
<thead>
|
||||
|
Loading…
Reference in New Issue
Block a user