from django import template from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def tag(): return 123django
@register.filter//只允許傳兩個參數(能夠傳字符串,而後在後臺進行分割)
def tag1(a1,a2):code
{% load map %} {% tag %} {{ 'mao'|tag1:'sister' }}字符串