问题
I'm using third-party apps (through Pinax), and I am trying to override a template file that the third-party template extends from.
That is --
Third party app:
templates/app/a.html
templates/base.html
My project:
templates/app/b.html
templates/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" %}.
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?
回答1:
You could see django-templateloaderwithpriorities or django-smart-extends
来源:https://stackoverflow.com/questions/10565751/override-a-django-third-party-application-template-through-extend