[minor] return '' if template is none & ignore if _custom_html field has no options (#3664)
This commit is contained in:
parent
087e88fab5
commit
e86e69b4e7
2 changed files with 4 additions and 1 deletions
|
|
@ -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) }}
|
||||
|
|
|
|||
|
|
@ -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/")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue