通过扩展覆盖django第三方应用程序模板 [英] Override a django third-party application template through extend

查看:289
本文介绍了通过扩展覆盖django第三方应用程序模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用第三方应用程序(通过Pinax),并且我试图覆盖第三方模板扩展的模板文件。

I'm using third-party apps (through Pinax), and I am trying to override a template file that the third-party template extends from.

是 -

Third party app:
    templates/app/a.html
    templates/base.html

My project:
    templates/app/b.html
    templates/base.html

我在第三方应用程序中复制并修改了 base.html ,以便在我自己的项目中使用,第三个party app / a.html 和我自己的 app / b.html do {%扩展base.html%}

Where I've copied and modified base.html from the third-party app for use in my own project and both the third-party app/a.html and my own app/b.html do {% extends "base.html" %}.

目前的行为是当 app / a.html extends base.html ,它正在加载第三方 base.html ,而code> app / b.html 正在加载我自己的 base.html 。首选行为是 app / a.html app / b.html 加载我的 base.html

The current behavior is that when app/a.html extends base.html, it's currently loading the third-party base.html, while app/b.html is loading my own base.html. The preferred behavior is for both app/a.html and app/b.html to load my base.html.

有没有办法为自己的模板文件设置优先级?

Is there a way to set priority to my own template files?

推荐答案

您可以看到 django-templateloaderwithpriorities django-smart-extensions

这篇关于通过扩展覆盖django第三方应用程序模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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