Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#1198 from hanshuaikang/feature/dev…
Browse files Browse the repository at this point in the history
…elop_by_han

minor: 调整复杂情况下自定义表单的显示内容
  • Loading branch information
hanshuaikang authored Sep 12, 2023
2 parents 656466a + 9479097 commit e3803dc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions itsm/ticket/models/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4041,14 +4041,12 @@ def display_content(field_type, content):
text_content = []
for data in content["form_data"]:
scheme = data["scheme"]
label = data["label"]
label = data.get("label")
detail = []
if isinstance(data["value"], str):
if label and data["value"]:
text_content.append(
"{}:\n{}\n".format(
label, data.get("label") or data["value"]
)
"{}:\n{}".format(label, data.get("label") or data["value"])
)
continue
for attr in data["value"]:
Expand All @@ -4057,7 +4055,7 @@ def display_content(field_type, content):
try:
if isinstance(attr_value["value"], str):
single.append(
"{}:{}\n".format(
"{}:{}".format(
schemes_map[scheme][attr_name],
attr_value.get("label") or attr_value["value"],
)
Expand All @@ -4068,9 +4066,8 @@ def display_content(field_type, content):
data, err
)
)
detail.append("".join(single))
if label:
text_content.append("{}:\n{}".format(label, "\n".join(detail)))
detail.append(", ".join(single))
text_content.append("{}:\n{}".format(label, "\n".join(detail)))
return "\n".join(text_content)
except Exception as err:
logger.exception(
Expand Down

0 comments on commit e3803dc

Please sign in to comment.