Django - 将整个网站的自定义标签替换为内置的模板,而不需要{%load ..%} [英] Django - replacing built-in templatetag by custom tag for a whole site without {% load .. %}

查看:188
本文介绍了Django - 将整个网站的自定义标签替换为内置的模板,而不需要{%load ..%}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 {%if%} 模板标签.org / snippets / 1350 /rel =nofollow noreferrer>这个代码段,因为我不想写每个 {%load smart_if%} 时间。此外,智能if将进入核心模板系统很快

I want to replace the standard {% if %} template tag with a "smart if" custom tag from this snippet, because I don't want to write {% load smart_if %} every time. Also, "smart if" will come into core template system very soon.

我忘了在哪里看到一个这样做的代码。有没有人知道如何更换内置的模板?

I forgot where I saw a piece of code that does this. Does anyone know how to replace a built-in templatetag?

推荐答案

不是一个完整的解决方案来替换if标签,而是您可以自动加载模板标签

Not a full solution to replace the "if" tag, but you can automatically load template tags.

这篇关于Django - 将整个网站的自定义标签替换为内置的模板,而不需要{%load ..%}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆