如何直接在模板中缓存urls.py中的视图

DZ.*_*DZ. 2 django caching

我想要cache一个模板,我知道可以在这里做到这一点url.但是,我想要缓存的特定模板也直接用于模板:

(r'^menu/$', direct_to_template, { 'template': 'corp_menu.html' }),
Run Code Online (Sandbox Code Playgroud)

有谁知道如何转换我urlcache使用Django文档这样的:

django文档显示

urlpatterns = ('',
(r'^foo/(\d{1,2})/$', cache_page(60 * 15)(my_view)),
)
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

Lak*_*sad 6

(r'^menu/$', cache_page(60 * 15)(direct_to_template), { 'template': 'corp_menu.html' }),
Run Code Online (Sandbox Code Playgroud)

应该管用.