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.bootstrap5 module¶
- class ferrosoft.apps.ferrobase.templatetags.bootstrap5.ModalNode(modal_id, size, title, fullscreen, extra_nodes)[source]¶
Bases:
NodeTemplate node emitting a Bootstrap 5
.modalcontaining the captured body.
- ferrosoft.apps.ferrobase.templatetags.bootstrap5.bootstrap_color_theme(value)[source]¶
Map a
ColorThemeenum 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
.modalshell with header, close button and configurable size.
ferrosoft.apps.ferrobase.templatetags.datetime module¶
ferrosoft.apps.ferrobase.templatetags.decimal module¶
- ferrosoft.apps.ferrobase.templatetags.decimal.format_decimal_rounded_full(value)[source]¶
Quantise
valueto whole units and locale-format the result.
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=valueon the current request.Existing query parameters from
request.GETare preserved; an existing entry forkeyis 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
Nonevalue is shown as a muted “(blank)” placeholder, otherwise the value is passed throughsimple_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_SEPARATORand includes, in order, the suppliedargs, the currentactivity_title, the active tenant’s name and the running app’s title — skipping any segment that is missing.- Return type:
- 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_nameuse the related model’sverbose_nameinstead. Unknown fields returnfield_nameverbatim.
- ferrosoft.apps.ferrobase.templatetags.ferrobase.field_value(model, field_name)[source]¶
Return a field’s value, preferring Django’s
get_<field>_displayaccessor.
- 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
Truewhenvalueis a DjangoErrorList.
- 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(seeget_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
argsanassoc_list_item()is emitted usingfield_label()for the term andfield_value()for the value.
- ferrosoft.apps.ferrobase.templatetags.ferrobase.round_decimal(value, b=None, rounding=None)[source]¶
Quantise a
DecimalorDecimalWithUnittob(default1.00).The unit of a
DecimalWithUnitis preserved through the rounding.
- ferrosoft.apps.ferrobase.templatetags.ferrobase.round_decimal_up(value, b=None)[source]¶
Shortcut for
round_decimal()withrounding=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/dateare localised;DecimalWithUnitis 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
Truewhengrant_rowrecords a truthy entry foraccess_mode.grant_rowis the per-subject mapping produced by the file-grants matrix;access_modeis the column key from theAccessModeenum being checked.- Return type:
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
argsare interpreted as(app_name, title); when omitted they fall back to the context variablesactivity_appandactivity_title. If the running app declaresAPP_META.restricted_app_menuthe 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:
NodeNode rendering a Foundation alert with icon, message and extra body.
- class ferrosoft.apps.ferrobase.templatetags.foundation.InlineEditRowNode(input_name, input_type, input_value, step, label_nodes)[source]¶
Bases:
NodeNode rendering a table row with a read-only view plus inline input control.
- class ferrosoft.apps.ferrobase.templatetags.foundation.RevealCloseButtonNode(open_target)[source]¶
Bases:
NodeNode rendering a Foundation modal close button.
- class ferrosoft.apps.ferrobase.templatetags.foundation.SkipNavigationNode(anchors)[source]¶
Bases:
NodeNode rendering an accessibility skip-navigation list.
- ferrosoft.apps.ferrobase.templatetags.foundation.checkbox_inputs(form_name, options)[source]¶
Render a vertical list of checkboxes.
optionsis an iterable of(value, label, enabled)tuples; entries flaggedenabledare rendered withchecked.
- ferrosoft.apps.ferrobase.templatetags.foundation.do_alert(parser, token)[source]¶
Compile
{% alert id level message %}…{% endalert %}.The block body is appended after
messageinside the alert container.levelselects 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
stepargument is used whentype == "number"to set thestepattribute 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 anopen_targetexpression it emitsdata-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.iam module¶
ferrosoft.apps.ferrobase.templatetags.labels module¶
ferrosoft.apps.ferrobase.templatetags.tables module¶
- class ferrosoft.apps.ferrobase.templatetags.tables.RenderTableNode(table, vertical_layout=None)[source]¶
Bases:
NodeTemplate node rendering a django-tables2 table or a queryset.
Accepts either a
Tableinstance or a queryset (in which case a table is generated on the fly viatable_factory). Whenvertical_layoutresolves to a truthy value the template receivesVERTICAL_TABLE_LAYOUT = Trueso the table can switch to a responsive portrait layout.