Added the title_case filter and replaced the title filter with the title_case filter to display titles in American English.
This commit is contained in:
accounting/templates/accounting
balance-sheet.htmlcash-summary.htmlcash.htmlincome-statement.htmljournal.htmlledger-summary.htmlledger.htmlsearch.html
transactions
trial-balance.htmlmia_core/templatetags
@ -20,6 +20,7 @@
|
||||
"""
|
||||
from datetime import date
|
||||
|
||||
import titlecase
|
||||
from django import template
|
||||
from django.template import defaultfilters
|
||||
from django.urls import reverse
|
||||
@ -217,3 +218,16 @@ def smart_month(value):
|
||||
if value.year == year and value.month == month:
|
||||
return gettext("Last Month")
|
||||
return defaultfilters.date(value, "Y/n")
|
||||
|
||||
|
||||
@register.filter
|
||||
def title_case(value):
|
||||
"""Formats the title in a proper American-English case.
|
||||
|
||||
Args:
|
||||
value (str): The title.
|
||||
|
||||
Returns:
|
||||
str: The title in a proper American-English case.
|
||||
"""
|
||||
return titlecase.titlecase(value)
|
||||
|
Reference in New Issue
Block a user