fix: シングル・ダブルクォート両対応

This commit is contained in:
shimoda.m@nds-tyo.co.jp 2023-07-28 09:17:31 +09:00
parent 89440b8511
commit 4d5a380db7
2 changed files with 5 additions and 4 deletions

View File

@ -62,8 +62,9 @@ class BioViewModel(BaseModel):
part_size = 500
for i in range(0, search_data_len, part_size):
json_str = json.dumps(search_data_list[i:i + part_size], ensure_ascii=False, default=date_handler)
# テンプレートに埋め込むため、ダブルクォートをエスケープして返す
json_str = json_str.replace('"', '\\"')
# JavaScriptに埋め込むため、クォートをエスケープ
json_str = json_str.replace("'", "\\'")
json_str = json_str.replace('\\"', '\\\\"')
yield json_str
def make_whs_name(self):

View File

@ -338,9 +338,9 @@
const searchResultData = []
// {% if bio.is_form_submitted() and not (bio.is_data_overflow_max_length() or bio.is_data_empty()) %}
// {% autoescape False%}
// ジェネレータで100件ずつ取ってリストに詰める
// ジェネレータですこしずつ取得してリストに詰める
// {% for bio_data_json_str in bio.bio_data_json_str() %}
searchResultData.push(...JSON.parse("{{bio_data_json_str}}"))
searchResultData.push(...JSON.parse('{{bio_data_json_str}}'))
// {% endfor %}
// {% endautoescape%}
// {% endif %}