注意文件一定要创建在应用下,文件名templatetags
xx.py文件前面加以下内容
from django import template
register = template.Library()
最无语的是,查了官方文档后发现我这个bug问题出在:
附上链接:How to create custom template tags and filters | Django 文档 | Django
注意文件一定要创建在应用下,文件名templatetags
xx.py文件前面加以下内容
from django import template
register = template.Library()
最无语的是,查了官方文档后发现我这个bug问题出在:
附上链接:How to create custom template tags and filters | Django 文档 | Django