<!-- the value -->
[‘python’, ‘is’, ‘fun'] | join:" - "
<!-- the output -->
"python - is - fun"
<!-- the value -->
[‘Monday’, ‘Tuesday’, ‘Wednesday'] | join:" // "
<!-- the output -->
"Monday // Tuesday // Wednesday"
<!-- the value -->
2023-01-12T10:30:00.000123 | date:"SHORT_DATE_FORMAT”
<!-- the output -->
‘01/12/2023’
<!-- the value -->
2022-12-12T10:30:00.000123 | date
<!-- the output -->
‘Dec. 12, 2022’
<!-- the value -->
2023-01-12T10:30:00.000123 | date:"D d M Y"
<!-- the output -->
Sun 12 Jan 2023’
<!-- the value -->
“ “ | default: "an empty string"
<!-- the output -->
‘an empty string’
<!-- the value -->
“ “ | default: "This is a default value"
<!-- the output if the value is an empty string -->
‘This is a default value’
<!-- the value -->
20 | add:"5"
<!-- the output -->
25
<!-- the value -->
[1, 2, 3] | add:”[4, 5, 6]”
<!-- the output -->
[1, 2, 3, 4, 5, 6]
<!-- the value -->
‘christmas’ | capfirst
<!-- the output -->
‘Christmas’
<!-- the value -->
‘django’ | capfirst
<!-- the output -->
‘Django’
<!-- the value -->
“Python is Fun” | cut:" "
<!-- the output -->
‘PythonisFun’
<!-- the value -->
“January - February - March” | cut:"-"
<!-- the output -->
‘January February March’
[
{'name': ‘Josh’, 'age': 19},
{'name': ‘Dave’, 'age': 22},
{'name': 'joe', 'age': 31},
]
then the output would be:
[
{'name': ‘Dave’, 'age': 22},
{'name': 'joe', 'age': 31},
{'name': ‘Josh’, 'age': 19},
]
<!-- the value -->
[
{'name': 'Abhi', 'age': 29},
{'name': 'Sonia', 'age': 25},
{'name': 'Rahul', 'age': 36},
]
<!-- the output -->
[
{'name': 'Abhi', 'age': 29},
{'name': 'Rahul', 'age': 36},
{'name': 'Sonia', 'age': 25},
]
<!-- the value -->
<p>This <em>should be</em> fun!</p> | escape
<!-- the output -->
<p>This <em>should be</em> fun!</p>
<!-- the value -->
[‘Apple’, ‘Mango’, ‘Orange’] | first
<!-- the output -->
‘Apple’
<!-- the value -->
[‘China’, ‘India’, ‘Thailand’] | first
<!-- the output -->
‘China’
<!-- the value -->
[‘Apple’, ‘Mango’, ‘Orange’] | last
<!-- the output -->
‘Orange’
<!-- the value -->
[‘China’, ‘India’, ‘Thailand’] | last
<!-- the output -->
‘Thailand’
<!-- the value -->
[‘Banana’, ‘Mango’, ‘Orange’] | length
<!-- the output -->
3
<!-- the value -->
“Welcome” | length
<!-- the output -->
7
cat
dog
horse
The output will be:
1. cat
2. dog
3. horse
If the value is:
Arnold
Brandy
Caleb
Dexter
The output will be:
1. Arnold
2. Brandy
3. Caleb
4. Dexter
<!-- the value -->
‘I Am Master Yoda’ | lower
<!-- the output -->
‘i am master yoda ‘
<!-- the value -->
‘Humpty Dumpty sat on the Wall’ | lower
<!-- the output -->
‘humpty dumpty sat on the wall‘
<!-- the value -->
‘Happy coding!’ | upper
<!-- the output -->
‘HAPPY CODING!’
<!-- the value -->
‘Nasa’ | upper
<!-- the output -->
‘NASA’
<!-- the value -->
‘I am a legend’ | title
<!-- the output -->
‘I Am A Legend’
<!-- the value -->
‘Django rest framework’ | title
<!-- the output -->
‘Django Rest Framework’
<!-- the value -->
[‘Banana’, ‘Mango’, ‘Orange’] | random
<!-- the output -->
‘Banana or Mango or Orange’
<!-- the value -->
[‘Father’, ‘Mother’, ‘Child’] | random
<!-- the output -->
‘Father or Mother or Child’
<!-- the value -->
[‘Banana’, ‘Mango’, ‘Orange’] | slice:":2"
<!-- the output -->
[‘Banana’, ‘Mango’]
<!-- the value -->
[‘Father’, ‘Mother’, ‘Child’] | slice:":2"
<!-- the output -->
[‘Father’, ‘Mother’]
<!-- the value -->
10:30:00.000123+02:00 | time:"H:i"
<!-- the output -->
10:30
<!-- the value -->
12:30:00.000123+02:00 | time:"H\h i\m"
<!-- the output -->
“12h 30m”
<!-- the value -->
2022-01-02T10:30:00.000123 | timesince
<!-- the output at 2022-01-02T12:30:00.000123 -->
‘2 hours’
<!-- the value -->
2023-01-02T9:30:00.000123 | timesince
<!-- the output at 2023-01-02T12:30:00.000123 -->
‘3 hours’
<!-- the value -->
‘Happy coding’ | truncatechars:6
<!-- the output -->
‘Happy…’
<!-- the value -->
‘Cloud computing’ | truncatechars:5
<!-- the output -->
‘Cloud…’
<!-- the value -->
‘Happy coding’ | wordcount
<!-- the output -->
2
<!-- the value -->
‘You can do a lot of modifications with template filters’ | wordcount
<!-- the output -->
10
<!-- the value -->
‘Better days ahead!’ | truncatewords:2
<!-- the output -->
‘Better days’
<!-- the value -->
“You can build web apps with python and Django” | truncatewords:7
<!-- the output -->
“You can build web apps with python”
<!-- the value -->
<b>I</b> <button>love</button> <span>dogs</span> | striptags
<!-- the output -->
‘I love dogs’
<!-- the value -->
<b>This</b> is <em>a</em> <button>Button</button> | striptags
<!-- the output -->
‘This is a Button’
You have {{ num_messages }} message {{ num_messages | pluralize }}.
You have {{ num_tomato }} tomato {{ num_tomato | pluralize:"es" }}.
You have {{ num_cherries }} cherr {{ num_cherries | pluralize:"y,ies" }}.
<!-- the value -->
You have {{ num_messages }} message {{ num_messages | pluralize }}.
<!-- the output if the value of num_messages is 4 -->
“You have 4 messages”
<!-- the value -->
‘Earthly’ | make_list
<!-- the output -->
[‘E’, ‘a’, ‘r’, ‘t’, ‘h’, ‘l’, ‘y’]
<!-- the value -->
‘ABCDEF’ | make_list
<!-- the output -->
[‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’]