theme switching, template and css file layout on a django site

 ̄綄美尐妖づ 提交于 2019-12-06 10:44:35

from loader_tags.py Include_Node do_extends doc:

This tag may be used in two ways: ``{% extends "base" %}`` (with quotes)
uses the literal value "base" as the name of the parent template to extend,
or ``{% extends variable %}`` uses the value of ``variable`` as either the
name of the parent template to extend (if it evaluates to a string) or as
the parent tempate itelf (if it evaluates to a Template object).

So i changed my templates to do

{% extends base %} 

instead of

{% extends "base.html" %}

and set context var "base" as theme + "/base.html" in my main controller before i call get_template

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!