fobi.templatetags package¶
Submodules¶
fobi.templatetags.fobi_tags module¶
Get the form handler plugin custom actions.
Note, that
plugin
shall be a instance offobi.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 %}
Get the form wizard handler plugin custom actions.
Note, that
plugin
shall be a instance offobi.models.FormWizardHandlerEntry
.Syntax: - {% get_fobi_form_wizard_handler_plugin_custom_actions
[plugin] [form_wizard_entry] as [context_var_name] %}
Example: - {% get_fobi_form_wizard_handler_plugin_custom_actions
- plugin form_wizard_entry as
form_wizard_handler_plugin_custom_actions %}
Get the plugin.
Note, that
entry
shall be a instance offobi.models.FormElementEntry
orfobi.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 }}
Get form field type.
Syntax:
{% get_form_field_type [field] as [context_var_name] %}
Example:
{% get_form_field_type form.field as form_field_type %} {% if form_field_type.is_checkbox %} ... {% endif %}
Get form hidden fields errors.
Syntax: {% get_form_hidden_fields_errors [form] as [context_var_name] %} Example: {% get_form_hidden_fields_errors form as form_hidden_fields_errors %} {{ form_hidden_fields_errors.as_ul }}
Checks the permissions
Syntax: {% has_edit_form_entry_permissions as [var_name] %}
Example: {% has_edit_form_entry_permissions %}
or
{% has_edit_form_entry_permissions as has_permissions %}
Render auth link.
Render the list of fobi forms.
Syntax: {% render_fobi_forms_list [queryset] [show_edit_link] [show_delete_link] [show_export_link] %} Example: {% render_fobi_forms_list queryset show_edit_link=True show_delete_link=False show_export_link=False %}
fobi.templatetags.future_compat module¶
Outputs the first variable passed that is not False.
Outputs nothing if all the passed variables are False.
Sample usage:
{% firstof var1 var2 var3 as myvar %}
This is equivalent to:
{% if var1 %} {{ var1 }} {% elif var2 %} {{ var2 }} {% elif var3 %} {{ var3 }} {% 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 disable auto-escaping of variables you can use:
{% autoescape off %} {% firstof var1 var2 var3 "<strong>fallback value</strong>" %} {% autoescape %}
Or if only some variables should be escaped, you can use:
{% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}