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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160929113704.GT6601%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to