fix: preserve template placeholders when editing message templates

This commit is contained in:
feng
2026-05-22 18:00:40 +08:00
committed by 老广
parent 7c1e2ba988
commit 8a4b7ea641

View File

@@ -195,7 +195,6 @@ class TemplateViewSet(JMSGenericViewSet):
serializer.is_valid(raise_exception=True)
template_name = serializer.validated_data['template_name']
content = serializer.validated_data['template_content']
render_html = serializer.validated_data['render_html']
data_path = _get_data_template_path(template_name)
edit_path = _get_edit_template_path(template_name)
@@ -203,7 +202,7 @@ class TemplateViewSet(JMSGenericViewSet):
try:
os.makedirs(data_dir, exist_ok=True)
with open(data_path, 'w', encoding='utf-8') as f:
f.write(render_html)
f.write(content)
with open(edit_path, 'w', encoding='utf-8') as f:
f.write(content)
except Exception as e: