How do I add multiple arguments to my custom template filter in a django template?

前端 未结 9 544
时光说笑
时光说笑 2020-11-27 12:20

Here\'s my custom filter:

from django import template

register = template.Library()

@register.filter
def replace(value, cherche, remplacement):
    retur         


        
9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 12:38

    Not possible according to this section of the docs:

    Custom filters are just Python functions that take one or two arguments:

    • The value of the variable (input) -- not necessarily a string.
    • The value of the argument -- this can have a default value, or be left out altogether.

提交回复
热议问题