fix: sort related assets field when viewing a log
This commit is contained in:
parent
8fc9851e21
commit
03dacd9957
1 changed files with 11 additions and 3 deletions
|
|
@ -667,10 +667,17 @@ class AssetRefsWidget(Widget):
|
||||||
|
|
||||||
readonly = kw.get("readonly", self.readonly)
|
readonly = kw.get("readonly", self.readonly)
|
||||||
if readonly:
|
if readonly:
|
||||||
|
|
||||||
assets = []
|
assets = []
|
||||||
for uuid in cstruct or []:
|
for uuid in cstruct or []:
|
||||||
asset = session.get(model.Asset, uuid)
|
if asset := session.get(model.Asset, uuid):
|
||||||
assets.append(
|
assets.append(asset)
|
||||||
|
|
||||||
|
assets.sort(key=lambda asset: asset.asset_name)
|
||||||
|
|
||||||
|
html = []
|
||||||
|
for asset in assets:
|
||||||
|
html.append(
|
||||||
HTML.tag(
|
HTML.tag(
|
||||||
"li",
|
"li",
|
||||||
c=tags.link_to(
|
c=tags.link_to(
|
||||||
|
|
@ -681,7 +688,8 @@ class AssetRefsWidget(Widget):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return HTML.tag("ul", c=assets)
|
|
||||||
|
return HTML.tag("ul", c=html)
|
||||||
|
|
||||||
values = kw.get("values", self.values)
|
values = kw.get("values", self.values)
|
||||||
if not isinstance(values, sequence_types):
|
if not isinstance(values, sequence_types):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue