fobi.templatetags package

Submodules

fobi.templatetags.fobi_tags module

fobi.templatetags.fobi_tags.get_fobi_form_handler_plugin_custom_actions(parser, token)[source]

Get 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.fobi_tags.get_fobi_form_wizard_handler_plugin_custom_actions(parser, token)[source]

Get the form wizard handler plugin custom actions.

Note, that plugin shall be a instance of fobi.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 %}

fobi.templatetags.fobi_tags.get_fobi_plugin(parser, token)[source]

Get 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 }}

fobi.templatetags.fobi_tags.get_form_field_type(parser, token)[source]

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 %}
fobi.templatetags.fobi_tags.get_form_hidden_fields_errors(parser, token)[source]

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 }}
fobi.templatetags.fobi_tags.has_edit_form_entry_permissions(parser, token)[source]

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.

fobi.templatetags.fobi_tags.render_fobi_forms_list(context, queryset, *args, **kwargs)[source]

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

fobi.templatetags.future_compat.firstof(parser, token)[source]

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 %}

Module contents