diff --git a/accounting/templates/accounting/balance-sheet.html b/accounting/templates/accounting/balance-sheet.html index b785424..112937c 100644 --- a/accounting/templates/accounting/balance-sheet.html +++ b/accounting/templates/accounting/balance-sheet.html @@ -73,7 +73,7 @@ First written: 2020/7/20 {# The table for large screens #}
-

{{ title|escape }}

+

{{ title|title_case }}

@@ -81,19 +81,19 @@ First written: 2020/7/20 - + {% for group in assets.groups %} - + {% for item in group.details %} - +
{{ assets.title|title }}{{ assets.title|title_case }}
{{ group.title|title }}
{{ group.title|title_case }}
{{ item.amount|accounting_amount }} @@ -112,19 +112,19 @@ First written: 2020/7/20 - + {% for group in liabilities.groups %} - + {% for item in group.details %} - +
{{ liabilities.title|title }}{{ liabilities.title|title_case }}
{{ group.title|title }}
{{ group.title|title_case }}
{{ item.amount|accounting_amount }} @@ -149,19 +149,19 @@ First written: 2020/7/20 - + {% for group in owners_equity.groups %} - + {% for item in group.details %} - + - + {% for section in item_list %} - + @@ -97,14 +97,14 @@ First written: 2020/7/19 {% if section.groups %} {% for group in section.groups %} - + {% for item in group.details %} - + - + @@ -159,17 +159,17 @@ First written: 2020/7/19 - + - + - + {% for x in item.debit_records %} - + @@ -152,7 +152,7 @@ First written: 2020/7/23 {% for x in item.debit_records %}
  • - {{ x.account.title|title }} + {{ x.account.title|title_case }} {{ x.amount|accounting_amount }}
    {{ x.summary|default:"" }}
    diff --git a/accounting/templates/accounting/transactions/income/view.html b/accounting/templates/accounting/transactions/income/view.html index d43cd38..af3c17c 100644 --- a/accounting/templates/accounting/transactions/income/view.html +++ b/accounting/templates/accounting/transactions/income/view.html @@ -134,7 +134,7 @@ First written: 2020/7/23
  • {% for x in item.credit_records %} - + @@ -152,7 +152,7 @@ First written: 2020/7/23 {% for x in item.credit_records %}
  • - {{ x.account.title|title }} + {{ x.account.title|title_case }} {{ x.amount|accounting_amount }}
    {{ x.summary|default:"" }}
    diff --git a/accounting/templates/accounting/transactions/transfer/view.html b/accounting/templates/accounting/transactions/transfer/view.html index e22cf49..ad55295 100644 --- a/accounting/templates/accounting/transactions/transfer/view.html +++ b/accounting/templates/accounting/transactions/transfer/view.html @@ -130,7 +130,7 @@ First written: 2020/7/23
  • {% for x in item.debit_records %} - + @@ -148,7 +148,7 @@ First written: 2020/7/23 {% for x in item.debit_records %}
  • - {{ x.account.title|title }} + {{ x.account.title|title_case }} {{ x.amount|accounting_amount }}
    {{ x.summary|default:"" }}
    x @@ -177,7 +177,7 @@ First written: 2020/7/23
  • {% for x in item.credit_records %} - + @@ -195,7 +195,7 @@ First written: 2020/7/23 {% for x in item.credit_records %}
  • - {{ x.account.title|title }} + {{ x.account.title|title_case }} {{ x.amount|accounting_amount }}
    {{ x.summary|default:"" }}
    x diff --git a/accounting/templates/accounting/trial-balance.html b/accounting/templates/accounting/trial-balance.html index c47d008..3c61bbc 100644 --- a/accounting/templates/accounting/trial-balance.html +++ b/accounting/templates/accounting/trial-balance.html @@ -76,7 +76,7 @@ First written: 2020/7/19 {# The table for large screens #}
    -

    {{ title|force_escape }}

    +

    {{ title|title_case }}

    @@ -93,7 +93,7 @@ First written: 2020/7/19
  • {% for item in item_list %} - +
    {{ owners_equity.title|title }}{{ owners_equity.title|title_case }}
    {{ group.title|title }}
    {{ group.title|title_case }}
    {{ item.amount|accounting_amount }} @@ -224,16 +224,16 @@ First written: 2020/7/20
    {{ item.transaction.date|smart_date }}{{ item.account.title|title }}{{ item.account.title|title_case }} {{ item.summary|default:"" }}{% if not item.is_balanced %} {% trans "Unbalanced" context "Accounting|" as text %} @@ -145,7 +145,7 @@ First written: 2020/7/1 {% if item.pk is not None %}
    diff --git a/accounting/templates/accounting/income-statement.html b/accounting/templates/accounting/income-statement.html index c5e0767..e3bd9bb 100644 --- a/accounting/templates/accounting/income-statement.html +++ b/accounting/templates/accounting/income-statement.html @@ -73,7 +73,7 @@ First written: 2020/7/19 {# The table for large screens #}
    -

    {{ title }}

    +

    {{ title|title_case }}

    @@ -89,7 +89,7 @@ First written: 2020/7/19
    {{ section.title|title }}
    {{ section.title|title_case }}
    {{ group.title|title }}
    {{ group.title|title_case }}
    {{ item.amount|accounting_amount }} @@ -132,7 +132,7 @@ First written: 2020/7/19 {% endif %} {% if section.cumulative_total is not None %}
    {{ section.cumulative_total.title|title }}
    {{ section.cumulative_total.title|title_case }}
    {{ section.cumulative_total.amount|accounting_amount }}
    {{ item.transaction.date|smart_date }}{{ item.account.title|title }}{{ item.account.title|title_case }}
    {{ item.summary|default:"" }}{% if not item.is_balanced %} {% trans "Unbalanced" context "Accounting|" as text %} @@ -126,7 +126,7 @@ First written: 2020/7/17
    @@ -163,7 +163,7 @@ First written: 2020/7/17 {% else %}
    diff --git a/accounting/templates/accounting/ledger-summary.html b/accounting/templates/accounting/ledger-summary.html index a234b7f..8d724ce 100644 --- a/accounting/templates/accounting/ledger-summary.html +++ b/accounting/templates/accounting/ledger-summary.html @@ -27,7 +27,7 @@ First written: 2020/7/16 {% load accounting %} {% block settings %} - {% blocktrans asvar title with account=account.title|title context "Accounting|" %}Ledger Summary for {{ account }}{% endblocktrans %} + {% blocktrans asvar title with account=account.title context "Accounting|" %}Ledger Summary for {{ account }}{% endblocktrans %} {% setvar "title" title %} {% static "accounting/css/report.css" as file %}{% add_css file %} {% endblock %} @@ -62,13 +62,13 @@ First written: 2020/7/16 {% endwith %}
    {{ item.transaction.date|smart_date }}{{ item.account.title|title }}{{ item.account.title|title_case }} {{ item.summary|default:"" }}{% if not item.is_balanced %} {% trans "Unbalanced" context "Accounting|" as text %} @@ -148,7 +148,7 @@ First written: 2020/7/16 {% if item.pk is not None %}
    @@ -197,7 +197,7 @@ First written: 2020/7/16 {% else %}
    diff --git a/accounting/templates/accounting/search.html b/accounting/templates/accounting/search.html index a73455a..f6bb436 100644 --- a/accounting/templates/accounting/search.html +++ b/accounting/templates/accounting/search.html @@ -93,7 +93,7 @@ First written: 2020/7/21 {% for item in item_list %}
    {{ item.transaction.date|smart_date }}{{ item.account.title|title }}{{ item.account.title|title_case }}
    {{ x.account.title|title }}{{ x.account.title|title_case }} {{ x.summary|default:"" }} {{ x.amount|accounting_amount }}
    {{ x.account.title|title }}{{ x.account.title|title_case }} {{ x.summary|default:"" }} {{ x.amount|accounting_amount }}
    {{ x.account.title|title }}{{ x.account.title|title_case }} {{ x.summary|default:"" }} {{ x.amount|accounting_amount }}
    {{ x.account.title|title }}{{ x.account.title|title_case }} {{ x.summary|default:"" }} {{ x.amount|accounting_amount }}
    {{ item.title|title }}{{ item.title|title_case }} {{ item.debit_amount|accounting_amount }} {{ item.credit_amount|accounting_amount }} @@ -130,7 +130,7 @@ First written: 2020/7/19 {% for item in item_list %}
  • - {{ item.title|title }} + {{ item.title|title_case }}
    {% if item.debit_amount is not None %} diff --git a/mia_core/templatetags/mia_core.py b/mia_core/templatetags/mia_core.py index 47a3494..95da9c9 100644 --- a/mia_core/templatetags/mia_core.py +++ b/mia_core/templatetags/mia_core.py @@ -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)