浏览代码

[minor] return '' if template is none & ignore if _custom_html field has no options (#3664)

version-14
Makarand Bauskar 8 年前
committed by GitHub
父节点
当前提交
e86e69b4e7
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. +1
    -1
      frappe/templates/print_formats/standard_macros.html
  2. +3
    -0
      frappe/utils/jinja.py

+ 1
- 1
frappe/templates/print_formats/standard_macros.html 查看文件

@@ -1,7 +1,7 @@
{% macro render_field(df, doc) -%}
{%- if df.fieldtype=="Table" -%}
{{ render_table(df, doc) }}
{%- elif df.fieldtype=="HTML" -%}
{%- elif df.fieldtype=="HTML" and df.options -%}
<div>{{ frappe.render_template(df.options, {"doc": doc}) or "" }}</div>
{%- elif df.fieldtype in ("Text", "Text Editor", "Code") -%}
{{ render_text_field(df, doc) }}


+ 3
- 0
frappe/utils/jinja.py 查看文件

@@ -57,6 +57,9 @@ def render_template(template, context, is_path=None):
:param context: dict of properties to pass to the template
:param is_path: (optional) assert that the `template` parameter is a path'''

if not template:
return ""

# if it ends with .html then its a freaking path, not html
if (is_path
or template.startswith("templates/")


正在加载...
取消
保存