from django.conf.urls import patterns, url

from .views import OppsDetail, OppsList, Search


urlpatterns = patterns(
    '',
    url(r'^$', OppsList.as_view(), name='home'),
    url(r'^search/', Search(), name='search'),
    url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
        OppsDetail.as_view(), name='open'),
    url(r'^(?P<channel__long_slug>[\w\b//-]+)/$', OppsList.as_view(),
        name='channel'),
)

from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page

from .views import OppsDetail, OppsList, Search


urlpatterns = patterns(
    '',
    url(r'^$', cache_page(60 * 2)(OppsList.as_view()), name='home'),
    url(r'^search/', Search(), name='search'),
    url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
        cache_page(60 * 15)(OppsDetail.as_view()), name='open'),
    url(r'^(?P<channel__long_slug>[\w\b//-]+)/$',
        cache_page(60 * 2)(OppsList.as_view()), name='channel'),
)

Add cache on article page (via url)
Add cache on article page (via url)

  from django.conf.urls import patterns, url
+ from django.views.decorators.cache import cache_page
  
  from .views import OppsDetail, OppsList, Search
  
  
  urlpatterns = patterns(
      '',
-     url(r'^$', OppsList.as_view(), name='home'),
+     url(r'^$', cache_page(60 * 2)(OppsList.as_view()), name='home'),
      url(r'^search/', Search(), name='search'),
      url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
-         OppsDetail.as_view(), name='open'),
+         cache_page(60 * 15)(OppsDetail.as_view()), name='open'),
-     url(r'^(?P<channel__long_slug>[\w\b//-]+)/$', OppsList.as_view(),
+     url(r'^(?P<channel__long_slug>[\w\b//-]+)/$',
-         name='channel'),
+         cache_page(60 * 2)(OppsList.as_view()), name='channel'),
  )
  
Add cache on article page (via url)
## Code Before:
from django.conf.urls import patterns, url

from .views import OppsDetail, OppsList, Search


urlpatterns = patterns(
    '',
    url(r'^$', OppsList.as_view(), name='home'),
    url(r'^search/', Search(), name='search'),
    url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
        OppsDetail.as_view(), name='open'),
    url(r'^(?P<channel__long_slug>[\w\b//-]+)/$', OppsList.as_view(),
        name='channel'),
)

## Instruction:
Add cache on article page (via url)
## Code After:
from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page

from .views import OppsDetail, OppsList, Search


urlpatterns = patterns(
    '',
    url(r'^$', cache_page(60 * 2)(OppsList.as_view()), name='home'),
    url(r'^search/', Search(), name='search'),
    url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
        cache_page(60 * 15)(OppsDetail.as_view()), name='open'),
    url(r'^(?P<channel__long_slug>[\w\b//-]+)/$',
        cache_page(60 * 2)(OppsList.as_view()), name='channel'),
)
