且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Django自定义模板过滤器无法正常工作

更新时间:2022-11-19 17:56:50

code> db 在您的 INSTALLED_APPS 设置?

Is db in your INSTALLED_APPS setting?

如果是,那么看起来你还缺少以下两件事:

If so, then it looks like the two other things you're missing are:


  • 一个 __ init __。py $ c $您的 db 文件夹中的c>文件(您的 templatefilters 目录中有一个,但不是其父目录)

  • templatefilters 文件夹应该称为 templatetags (见代码布局部分。 li>
  • an __init__.py file in your db folder itself (you've got one in your templatefilters directory, but not its parent directory)
  • the templatefilters folder should be called templatetags (see the Code layout section of the documentation).

顺便提一句, db 不是应用程序的非常好的名称 - 这更紧密地标识了 它的作用。

Incidentally, db is not a very good name for an app - call it something that more closely identifies what it does.