Django 2 by Example
上QQ阅读APP看书,第一时间看更新

Creating custom template tags and filters

Django offers a variety of built-in template tags, such as {% if %} or {% block %}. You have used several in your templates. You can find a complete reference of built-in template tags and filters at https://docs.djangoproject.com/en/2.0/ref/templates/builtins/.

However, Django also allows you to create your own template tags to perform custom actions. Custom template tags come in very handy when you need to add a functionality to your templates that is not covered by the core set of Django template tags.