On Thu, Sep 29, 2016 at 03:47:11AM -0700, Web Architect wrote:
> Hi Serge,
>
> Thanks for your response.
>
> We do not have any Views implemented for flatpages. I think they are Django
> internal stuff for static html content (something like a CMS):
>
>
https://docs.djangoproject.com/en/1.10/ref/contrib/flatpages/
>
> Have used the url pattern as in the example mentioned in the link above:
>
> from django.contrib.flatpages import views
> urlpatterns += [
> url(r'^about-us/$', views.flatpage, {'url': '/about-us/'}, name='about'),
> url(r'^license/$', views.flatpage, {'url': '/license/'}, name='license'),]
You can use the cache_control view decorator to wrap the flatpage view
before you plug it into your urlpatterns::
from django.contrib.flatpages import views
from django.views.decorators.cache import cache_control
cached_flatpage = cache_control(max_age=4700)(views.flatpage)
urlpatterns += [
url(r'^about-us/$', cached_flatpage, {'url': '/about-us/'}, name='about'),
url(r'^license/$', cached_flatpage, {'url': '/license/'}, name='license'),]
Cheers,
Michal