No description available
pip install fastpluggy-ui-tools
pip install fastpluggy-ui-tools==0.0.4
A FastPluggy module that provides a collection of Jinja2 template filters and HTML rendering utilities for building user interfaces.
It includes base64 encoding, Pydantic model dumping, localization, JSON rendering, and image embedding.
b64encode
filter to convert binary data to Base64 strings.pydantic_model_dump
filter to serialize Pydantic BaseModel
or BaseSettings
instances to dictionaries.localizedcurrency
, localizeddate
, and nl2br
filters for number, date/time formatting, and newline-to-HTML conversions using Babel.from_json
filter and HTML list conversion utilities for safely displaying JSON data.<img>
tags.UiToolsModule
plugin.TODO: add widget description
Install dependencies:
pip install -r requirements.txt
Filter | Description |
---|---|
b64encode |
Base64-encode binary data (bytes → str ). |
pydantic_model_dump |
Dump Pydantic models/settings to dictionaries. |
localizedcurrency |
Format a number as localized currency (default: EUR , fr_FR ). |
localizeddate |
Format dates/datetimes with various styles/locales/timezones. |
nl2br |
Convert newline characters to <br> tags. |
from_json |
Parse a JSON string into Python objects (list /dict ). |
render_bytes_size |
Format a size into human readable |
Example in a Jinja2 template:
<h2>{{ user.name }}</h2>
<p>Balance: {{ user.balance | localizedcurrency('USD', 'en_US') }}</p>
<p>Joined: {{ user.joined_at | localizeddate('long', 'short', 'en_US') }}</p>
<pre>{{ config | pydantic_model_dump | pprint }}</pre>
Import and use functions from html_render.py
to render JSON or image data in HTML:
from ui_tools.html_render import render_data_field, render_safe_data_field
# Render JSON string as HTML list
html_list = render_data_field(json_string)
# Safely render arbitrary data
safe_html = render_safe_data_field(raw_input)
Ensure you have pytest
installed, then run:
pytest tests/
git checkout -b feature/your-feature
.This project is licensed under the MIT License. See LICENSE for details.
This plugin does not have a Changelog file or it could not be extracted from the package.
API documentation for this plugin is not available.
Last analysis performed: 2025-07-06 19:26:43
This plugin has a valid entry point:
ui_tools
= fastpluggy_plugin.ui_tools.plugin:UiToolsModule
Issues were found during analysis, but details are not available.
fastpluggy_plugin.ui_tools.plugin:UiToolsModule