任何方法,使{%扩大'...'%}条件? - Django的 [英] Any way to make {% extends '...' %} conditional? - Django

查看:198
本文介绍了任何方法,使{%扩大'...'%}条件? - Django的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想和大家分享AJAX和regualr HTTP调用之间的模板,唯一的区别是,一个模板需要与base.html HTML,另外一个没有送达。

I would like to share a template between AJAX and regualr HTTP calls, the only difference is that one template needs to be served with the base.html html, the other one without.

你知道吗?

推荐答案

使用一个变量。

{% extends base_template %}

和你的观点,将其设置为你的观点base.html,还是一个新的ajax.html文件,该文件只是提供了块而已。

and in your view, set it to "base.html" in your view, or a new "ajax.html" file which just provides the block and nothing else.

这篇关于任何方法,使{%扩大'...'%}条件? - Django的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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