Revised the title_case template filter to work with gettext_lazy() in the Mia core application.
This commit is contained in:
parent
5d4060c919
commit
adcd97dd98
@ -25,6 +25,7 @@ from django import template
|
|||||||
from django.template import defaultfilters
|
from django.template import defaultfilters
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.safestring import SafeString
|
||||||
from django.utils.translation import gettext
|
from django.utils.translation import gettext
|
||||||
|
|
||||||
from mia_core.status import retrieve_status
|
from mia_core.status import retrieve_status
|
||||||
@ -230,4 +231,7 @@ def title_case(value):
|
|||||||
Returns:
|
Returns:
|
||||||
str: The title in a proper American-English case.
|
str: The title in a proper American-English case.
|
||||||
"""
|
"""
|
||||||
|
value = str(value)
|
||||||
|
if isinstance(value, SafeString):
|
||||||
|
value = value + ""
|
||||||
return titlecase.titlecase(value)
|
return titlecase.titlecase(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user