You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tpl, err := pongo2.FromString(`{% for el in ssrCatalogList %} {% if "number" in (el.OlType) %} {{forloop.Counter}} {% endif %} {%endfor%}`)
if err != nil {
panic(err)
}
if err != nil {
panic(err)
}
// Now you can render the template with the given
// pongo2.Context how often you want to.
out, err := tpl.Execute(pongo2.Context{"ssrCatalogList": []interface{}{
map[string]string{"IsTitle": "number1234567890", "Text": "fdfd", "OlType": "dsdsnumberdsds"},
map[string]string{"IsTitle": "number1234567890", "Text": "ffff"},
}})
if err != nil {
panic(err)
}
fmt.Println(out) // Output: Hello Florian!
tpl, err := pongo2.FromString(`{% for el in ssrCatalogList %} {% if "number" in (el.OlType or "") %} {{forloop.Counter}} {% endif %} {%endfor%}`)
if err != nil {
panic(err)
}
if err != nil {
panic(err)
}
// Now you can render the template with the given
// pongo2.Context how often you want to.
out, err := tpl.Execute(pongo2.Context{"ssrCatalogList": []interface{}{
map[string]string{"IsTitle": "number1234567890", "Text": "fdfd", "OlType": "dsdsnumberdsds"},
map[string]string{"IsTitle": "number1234567890", "Text": "ffff"},
}})
if err != nil {
panic(err)
}
fmt.Println(out) // Output: Hello Florian!
the only diff is "number" in (el.OlType or "") and "number" in el.OlType, the result is different
The text was updated successfully, but these errors were encountered:
the only diff is
"number" in (el.OlType or "")
and"number" in el.OlType
, the result is differentThe text was updated successfully, but these errors were encountered: