feat: implement django-cotton

This commit is contained in:
Herculino Trotta
2024-10-18 15:05:01 -03:00
parent 3aa6f12677
commit 8a3799c359
10 changed files with 379 additions and 266 deletions

View File

@@ -16,26 +16,6 @@ def _format_string(prefix, amount, decimal_places, suffix):
return f"{prefix}{formatted_amount}{suffix}"
@register.simple_tag(name="transaction_amount")
def transaction_currency(transaction: Transaction):
prefix = transaction.account.currency.prefix
amount = transaction.amount
decimal_places = transaction.account.currency.decimal_places
suffix = transaction.account.currency.suffix
return _format_string(prefix, amount, decimal_places, suffix)
@register.simple_tag(name="entry_amount")
def entry_currency(entry):
prefix = entry["prefix"]
amount = entry["amount"]
decimal_places = entry["decimal_places"]
suffix = entry["suffix"]
return _format_string(prefix, amount, decimal_places, suffix)
@register.simple_tag(name="currency_display")
def currency_display(amount, prefix, suffix, decimal_places):
return _format_string(prefix, amount, decimal_places, suffix)