开发者

return django view to template tag

I want have template tag...

开发者_C百科

There is some view and template ( named X ), when i call this view, return some html

for example

<h1>hi</h1>

In index of test application, i want when call template tag in template of this view, template tag return html of named X

for example

<h2>test</h2>
{% template_Tag_return_x_view %}

result

<h2>test</h2>
<h1>hi</h1>

whats is best way?


If you want to reuse your view's logic in several places it maybe it easier to turn the view into an inclusion tag.

It's more flexible than a simple include as you can specify parameters that influence the output.


I suggest you look at the include template tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜