fobi.templatetags package¶
Submodules¶
fobi.templatetags.fobi_tags module¶
Gets the plugin. Note, that entry shall be a instance of fobi.models.FormElementEntry or fobi.models.FormHandlerEntry.
Syntax: {% get_fobi_plugin entry as [context_var_name] %}
Example: {% get_fobi_plugin entry as plugin %}
{% get_fobi_plugin entry as plugin %} {{ plugin.render }}
Gets the form handler plugin custom actions. Note, that plugin shall be a instance of fobi.models.FormHandlerEntry.
Syntax: {% get_fobi_form_handler_plugin_custom_actions [plugin] [form_entry] as [context_var_name] %} Example: {% get_fobi_form_handler_plugin_custom_actions plugin form_entry as form_handler_plugin_custom_actions %}
fobi.templatetags.future_compat module¶
Outputs the first variable passed that is not False, without escaping.
Outputs nothing if all the passed variables are False.
Sample usage:
{% firstof var1 var2 var3 %}
This is equivalent to:
{% if var1 %} {{ var1|safe }} {% elif var2 %} {{ var2|safe }} {% elif var3 %} {{ var3|safe }} {% endif %}
but obviously much cleaner!
You can also use a literal string as a fallback value in case all passed variables are False:
{% firstof var1 var2 var3 "fallback value" %}
If you want to escape the output, use a filter tag:
{% filter force_escape %} {% firstof var1 var2 var3 "fallback value" %} {% endfilter %}