from django.utils.html import format_html from src.admin.base import admin_site # noqa: F401 def format_strong(text): return format_html("{}", text) def format_strong_with_subtext(primary, secondary, secondary_color="#888"): return format_html( "{}
{}", primary, secondary_color, secondary if secondary else "—", ) def format_placeholder(value=None, placeholder="—", color="#888"): return ( value if value else format_html("{}", color, placeholder) ) def format_badge(label, background="#333", text_color="white"): return format_html( "{}", background, text_color, label, ) def format_currency(amount): return format_html("${:,.2f}", amount) if amount is not None else "—" def format_boolean_icon( flag, true_icon="✅", false_icon="❌", true_color="#28a745", false_color="#999" ): color = true_color if flag else false_color icon = true_icon if flag else false_icon return format_html( "{}", color, icon, ) def format_link(url, label=None): return ( format_html("{}", url, label or url) if url else format_placeholder() ) def format_colored_text_with_subtext(color, label, subtext): return format_html( "{}
{}", color, label, subtext, )