Template Filter - random
ExampleGet your own Django Server
Return a random list item:
<h1>My favorite fruit is {{ fruits|random }}</h1>
Run Example »
Definition and Usage
The random
filter returns a random item of
an object.
Syntax
Template filters are defined by using a pipe |
character followed by the name of the filter.
{{ value|random }}