How to judge if a number or its calculation result can be used as a divisor in the AnQi CMS template?
divisibleby
The filter can determine whether a number or its calculation result can be used as a divisor. The filter will return a boolean value (bool), True means yes, and False means no.
How to use
divisibleby
How to use filters:
{{ number|divisibleby:取模值 }}
For example, the following judgment21
use3
After taking the modulus, whether it can be used as a divisor can be written like this:
{{ 22|divisibleby:"3" }}
# 显示结果
False
Sample Demo
{{ 21|divisibleby:3 }}
{{ 21|divisibleby:"3" }}
{{ 21|float|divisibleby:"3" }}
{{ 22|divisibleby:"3" }}
{{ 85|divisibleby:42 }}
{{ 84|divisibleby:42 }}
# 显示结果
True
True
True
False
False
True