Skip to content

Instantly share code, notes, and snippets.

@anderser
Created January 24, 2012 10:28
Show Gist options
  • Save anderser/1669515 to your computer and use it in GitHub Desktop.
Save anderser/1669515 to your computer and use it in GitHub Desktop.
Using cache decorator in urls.py to keep the app DRY
from django.conf.urls.defaults import *
from timelineit.views import *
from django.views.decorators.cache import cache_control,never_cache
urlpatterns = patterns('timelineit.views',
url(r'^desk/(?P<slug>[-\w\d]+)',
never_cache(timeline_preview),
name="timeline_preview"),
url(r'^(?P<slug>[-\w\d]+)',
cache_control(max_age=300)(timeline),
name="timeline"),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment