Template Filter - divisibleby
Example
Check if a value is divisible by 5:
{% if totalsum|divisibleby:5 %}
<h1>Yes, it is!</h1>
{% endif %}
Run Example »
Definition and Usage
The divisibleby
filter returns
True
if the value is divisible by the argument,
otherwise it returns False
.
Example
Display the answer, is totalsum
divisible by
3:
<h1>{{ totalsum|divisibleby:3 }}</h1>
Run Example »
Syntax
{{ value|divisibleby:num }}
Template filters are defined by using a pipe |
character followed by the name of the filter.
Arguments are defined by using a colon :
character followed by the argument value.
Arguments
Value | Description |
---|---|
num | Required. A number to try to divide the value with. |