Sfoglia il codice sorgente

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

version-14
Makarand Bauskar 8 anni fa
committed by GitHub
parent
commit
e86e69b4e7
2 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  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 Vedi File

@@ -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 Vedi File

@@ -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/")


Caricamento…
Annulla
Salva