ferrosoft.apps.ferrobase.templatetags package

Submodules

ferrosoft.apps.ferrobase.templatetags.ajax module

Template tags wiring the front-end AJAX/HTMX loading indicator.

ferrosoft.apps.ferrobase.templatetags.ajax.ajax_loading_indicator()[source]

Render the global #ajax-indicator container with a localised label.

ferrosoft.apps.ferrobase.templatetags.ajax.report_ajax_loading()[source]

Emit Hyperscript handlers that show/hide the indicator around HTMX requests.

ferrosoft.apps.ferrobase.templatetags.bootstrap5 module

class ferrosoft.apps.ferrobase.templatetags.bootstrap5.ModalNode(modal_id, size, title, fullscreen, extra_nodes)[source]

Bases: Node

Template node emitting a Bootstrap 5 .modal containing the captured body.

render(context)[source]

Resolve filter expressions against context and emit the modal HTML.

ferrosoft.apps.ferrobase.templatetags.bootstrap5.bootstrap_color_theme(value)[source]

Map a ColorTheme enum value to the Bootstrap "dark"/"light" token.

ferrosoft.apps.ferrobase.templatetags.bootstrap5.do_modal(parser, token)[source]

Compile a {% bs5_modal id size title [fullscreen=expr] %}…{% end_bs5_modal %} block.

The captured body is rendered as the modal contents inside a Bootstrap 5 .modal shell with header, close button and configurable size.

ferrosoft.apps.ferrobase.templatetags.bootstrap5.ferrosoft_auto_theme(value)[source]

Emit data-fs-auto-theme="true" when value is ColorTheme.AUTO.

ferrosoft.apps.ferrobase.templatetags.datetime module

ferrosoft.apps.ferrobase.templatetags.datetime.localized_datetime(context, value, *args)[source]

Render value in the requesting user’s timezone, then localise.

Reads context['user'] to determine the user’s preferred timezone via user_zoneinfo(). Returns an empty string when value is falsy.

ferrosoft.apps.ferrobase.templatetags.decimal module

ferrosoft.apps.ferrobase.templatetags.decimal.format_decimal_rounded_full(value)[source]

Quantise value to whole units and locale-format the result.

ferrosoft.apps.ferrobase.templatetags.decimal.format_money(value)[source]

Round value with BigMoneyField.round() and locale-format it.

ferrosoft.apps.ferrobase.templatetags.decimal.format_quantity_ton(value)[source]

Round value with TonDecimalField.round() and locale-format it.

ferrosoft.apps.ferrobase.templatetags.ferrobase module

Core ferrobase template library.

Bundles tags and filters used throughout the platform’s templates: document title composition, model introspection, value formatting, simple format dispatch, association-list rendering, query-string helpers and context-help URL generation.

ferrosoft.apps.ferrobase.templatetags.ferrobase.DOCUMENT_TITLE_SEPARATOR = ' | '

Separator inserted between document-title segments.

ferrosoft.apps.ferrobase.templatetags.ferrobase.append_query(context, key, value)[source]

Build a query string that adds/overrides key=value on the current request.

Existing query parameters from request.GET are preserved; an existing entry for key is removed first to avoid duplicates.

ferrosoft.apps.ferrobase.templatetags.ferrobase.assoc_list_item(title, icon, value, wrapper_class=None)[source]

Render a single <dt>/<dd> definition-list entry.

A None value is shown as a muted “(blank)” placeholder, otherwise the value is passed through simple_format() for type-aware display.

ferrosoft.apps.ferrobase.templatetags.ferrobase.document_title(context, *args)[source]

Compose the page’s <title> from positional args and request context.

The result is joined by DOCUMENT_TITLE_SEPARATOR and includes, in order, the supplied args, the current activity_title, the active tenant’s name and the running app’s title — skipping any segment that is missing.

Return type:

str

ferrosoft.apps.ferrobase.templatetags.ferrobase.field_label(model, field_name)[source]

Resolve a field’s human-readable label, with a special case for FK fields.

Foreign keys without an explicit verbose_name use the related model’s verbose_name instead. Unknown fields return field_name verbatim.

ferrosoft.apps.ferrobase.templatetags.ferrobase.field_value(model, field_name)[source]

Return a field’s value, preferring Django’s get_<field>_display accessor.

ferrosoft.apps.ferrobase.templatetags.ferrobase.font_icon(name)[source]

Render a Bootstrap icon <i> element with the given CSS class.

ferrosoft.apps.ferrobase.templatetags.ferrobase.form_errors_verbatim(value)[source]

Return True when value is a Django ErrorList.

ferrosoft.apps.ferrobase.templatetags.ferrobase.form_field_name(field_name, form)[source]

Return the form field’s label when available, else the raw field_name.

ferrosoft.apps.ferrobase.templatetags.ferrobase.help_button(topic)[source]

Render an external-link Help button pointing at the topic’s help page.

ferrosoft.apps.ferrobase.templatetags.ferrobase.help_url(topic)[source]

Return the context-help URL for topic (see get_help_url()).

ferrosoft.apps.ferrobase.templatetags.ferrobase.model_absolute_url(model)[source]

Return the model’s absolute URL, falling back to the conventional update route.

ferrosoft.apps.ferrobase.templatetags.ferrobase.model_values(model, *args)[source]

Render a definition list containing one entry per requested model field.

For every field name in args an assoc_list_item() is emitted using field_label() for the term and field_value() for the value.

ferrosoft.apps.ferrobase.templatetags.ferrobase.round_decimal(value, b=None, rounding=None)[source]

Quantise a Decimal or DecimalWithUnit to b (default 1.00).

The unit of a DecimalWithUnit is preserved through the rounding.

ferrosoft.apps.ferrobase.templatetags.ferrobase.round_decimal_up(value, b=None)[source]

Shortcut for round_decimal() with rounding=ROUND_UP.

ferrosoft.apps.ferrobase.templatetags.ferrobase.simple_format(value)[source]

Locale-aware formatter dispatching on common scalar types.

Datetimes get their localised representation suffixed with the timezone abbreviation; Decimal/date are localised; DecimalWithUnit is rendered with its unit symbol; booleans become “Yes”/”No”. All other values are returned unchanged.

ferrosoft.apps.ferrobase.templatetags.ferrobase_files module

ferrosoft.apps.ferrobase.templatetags.ferrobase_files.is_access_granted(grant_row, access_mode)[source]

Return True when grant_row records a truthy entry for access_mode.

grant_row is the per-subject mapping produced by the file-grants matrix; access_mode is the column key from the AccessMode enum being checked.

Return type:

bool

ferrosoft.apps.ferrobase.templatetags.ferrobase_menu module

ferrosoft.apps.ferrobase.templatetags.ferrobase_menu.ferrobase_menu(context, *args)[source]

Render the application menu for the current activity.

Positional args are interpreted as (app_name, title); when omitted they fall back to the context variables activity_app and activity_title. If the running app declares APP_META.restricted_app_menu the menu is restricted to that single app (single-app mode).

ferrosoft.apps.ferrobase.templatetags.foundation module

class ferrosoft.apps.ferrobase.templatetags.foundation.AlertNode(alert_id, level, message, extra)[source]

Bases: Node

Node rendering a Foundation alert with icon, message and extra body.

render(context)[source]

Resolve attributes against context and render the alert.

class ferrosoft.apps.ferrobase.templatetags.foundation.InlineEditRowNode(input_name, input_type, input_value, step, label_nodes)[source]

Bases: Node

Node rendering a table row with a read-only view plus inline input control.

render(context)[source]

Resolve attributes and emit the row, including number-specific styling.

class ferrosoft.apps.ferrobase.templatetags.foundation.RevealCloseButtonNode(open_target)[source]

Bases: Node

Node rendering a Foundation modal close button.

render(context)[source]

Emit the button with the appropriate data-close/data-open attribute.

class ferrosoft.apps.ferrobase.templatetags.foundation.SkipNavigationNode(anchors)[source]

Bases: Node

Node rendering an accessibility skip-navigation list.

render(context)[source]

Resolve each anchor and render the skip-navigation container.

ferrosoft.apps.ferrobase.templatetags.foundation.checkbox_inputs(form_name, options)[source]

Render a vertical list of checkboxes.

options is an iterable of (value, label, enabled) tuples; entries flagged enabled are rendered with checked.

ferrosoft.apps.ferrobase.templatetags.foundation.do_alert(parser, token)[source]

Compile {% alert id level message %}…{% endalert %}.

The block body is appended after message inside the alert container. level selects the icon ("info"fi-info, "alert"fi-alert, anything else → fi-megaphone).

ferrosoft.apps.ferrobase.templatetags.foundation.do_inline_edit_row(parser, token)[source]

Compile {% inline_edit_row name type value [step] %}label{% end_inline_edit_row %}.

Captures the block body as the row label. The optional step argument is used when type == "number" to set the step attribute on the resulting input.

ferrosoft.apps.ferrobase.templatetags.foundation.do_reveal_close_button(parser, token)[source]

Compile {% reveal_close_button [open_target] %}.

With no argument the button emits data-close; with an open_target expression it emits data-open="<target>" instead.

ferrosoft.apps.ferrobase.templatetags.foundation.do_skip_navigation(parser, token)[source]

Compile {% skip_navigation id1 label1 id2 label2 %}.

Accepts an even number of arguments interpreted as pairs of an element ID and its visible label; each pair becomes a skip-to anchor.

ferrosoft.apps.ferrobase.templatetags.foundation.select_input(form_name, options)[source]

Render a required <select> whose entries come from options.

options is an iterable of (value, label) tuples; the field is rendered with an empty leading placeholder option.

ferrosoft.apps.ferrobase.templatetags.foundation.window_open(window_name, width, height)[source]

Emit a Hyperscript snippet that opens a sized popup on click.

ferrosoft.apps.ferrobase.templatetags.iam module

ferrosoft.apps.ferrobase.templatetags.iam.iam_url_self_management()[source]

Return the absolute URL to the Zitadel self-management console.

ferrosoft.apps.ferrobase.templatetags.iam.iam_url_user_management()[source]

Return the absolute URL to the Zitadel admin user-management console.

ferrosoft.apps.ferrobase.templatetags.labels module

ferrosoft.apps.ferrobase.templatetags.labels.global_setting()[source]

Render a warning badge marking a setting as global (cross-tenant).

ferrosoft.apps.ferrobase.templatetags.tables module

class ferrosoft.apps.ferrobase.templatetags.tables.RenderTableNode(table, vertical_layout=None)[source]

Bases: Node

Template node rendering a django-tables2 table or a queryset.

Accepts either a Table instance or a queryset (in which case a table is generated on the fly via table_factory). When vertical_layout resolves to a truthy value the template receives VERTICAL_TABLE_LAYOUT = True so the table can switch to a responsive portrait layout.

render(context)[source]

Resolve, prepare and render the table; supports template-name lists.

ferrosoft.apps.ferrobase.templatetags.tables.render_table(parser, token)[source]

Compile {% render_table table [vertical_layout] %}.

The first argument is the table or queryset; the optional second argument controls portrait/responsive rendering.