feat: Add price formatting filter and update invoice templates for improved display
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user