DZ.
DZ.

Reputation: 3261

How to cache a view in urls.py when it is direct to template

I would like to cache a template and I know that it possible to do this in the url. However, the specific template I would like to cache is also delviered with a direct to template:

(r'^menu/$', direct_to_template, { 'template': 'corp_menu.html' }),

Does anyone know how to convert my url to cache this using the django documentation:

The django documentation shows

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

Thanks for any help

Upvotes: 2

Views: 590

Answers (1)

lprsd
lprsd

Reputation: 87215

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

should work.

Upvotes: 6

Related Questions