feat: Add price formatting filter and update invoice templates for improved display

This commit is contained in:
Parsa Nazer
2025-12-28 12:49:42 +03:30
parent 796c81ef35
commit 6142590868
4 changed files with 39 additions and 21 deletions
@@ -0,0 +1,18 @@
from django import template
register = template.Library()
@register.filter(name='price_format')
def price_format(value):
"""
Format a number with thousand separators (commas).
Example: 1234567 -> 1,234,567
"""
try:
# Convert to int to remove decimals
value = int(float(value))
# Format with thousand separators
return "{:,}".format(value)
except (ValueError, TypeError):
return value