开发者

Django: Is there any way to delay the loading and rendering of included template?

Say, I have the following template snippet:

  <div class="endless_page_template">
    {% include page_template %}
  </div>

The snippet is within a tab, which is behind other tabs when the page is first loaded and its content won't show until use开发者_高级运维r clicks on the tab.

Question: Is there any way to delay the loading and rendering of page_template until a specific event is triggered at the client-side?


Change that template to have a little AJAX loader graphic as the contents. Then create a new view to load page_template from an AJAX request that is triggered on the tab's click event.


I have django-partial-page application with middleware that delays blocks rendering and also has Javascript that allows loading of those blocks. It's not intended exactly for tabbed forms, but with a little of code one can make it.

Run the example project on your machine and see how it handles delayed_block tag.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜