Fix (or document) lower-casing behavior of title filter
The following seems unexpected to me, although there may be use cases where it's expected behavior (e.g. if you have all capitalized text and want it titled). See also #21299.
>>> from django.template.defaultfilters import title
>>> title("ABC News")
u'Abc News'
Change History
(4)
Cc: |
bmispelon@… added
|
Component: |
Uncategorized → Template system
|
Easy pickings: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Component: |
Template system → Documentation
|
Type: |
Uncategorized → Cleanup/optimization
|
Version: |
1.4 → master
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
That behavior is consistent with python's
str.title
method [1].Django's
title
function has two features on top ofstr.title
:title("isn't it") == "Isn't It"
(whereas"isn't it".title() == "Isn'T It
)title("8foo") == "8foo"
(whereas"8foo".title() == "8Foo"
)I don't think we can fix this particular issue without breaking backwards-compatibility so I think documenting it is the best course of action.
[1] http://docs.python.org/2/library/stdtypes.html?highlight=str.title#str.title