Fixes #18738: Ensure ScriptList respects script_order option

This commit is contained in:
Jason Novinger 2025-03-26 15:35:06 -05:00
parent be26f86b62
commit 39a96ddf3a
2 changed files with 10 additions and 1 deletions

View File

@ -117,6 +117,15 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
def __str__(self): def __str__(self):
return self.python_name 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 @property
def module_scripts(self): def module_scripts(self):

View File

@ -37,7 +37,7 @@
{% endif %} {% endif %}
</div> </div>
</h2> </h2>
{% with scripts=module.scripts.all %} {% with scripts=module.ordered_scripts %}
{% if scripts %} {% if scripts %}
<table class="table table-hover scripts"> <table class="table table-hover scripts">
<thead> <thead>