Is there a filter for divide for Django Template?

前端 未结 6 1883
囚心锁ツ
囚心锁ツ 2020-12-20 11:01

I noticed there is built-in add filter, but I wasn\'t able to find divide.

I am new to Django and not sure if there is a such filter.

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-20 11:34

    You can use divisibleby

    Returns True if the value is divisible by the argument.

    For example:

    {{ value|divisibleby:"3" }}

    If value is 21, the output would be True.

    You can see django docs

提交回复
热议问题