Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4c01b7288c
Fetching contributors…

Cannot retrieve contributors at this time

file 15 lines (13 sloc) 0.495 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
from django.conf import settings
from django.core.cache import cache

from django_website.docs.models import DocumentRelease

def recent_release(request):
    recent_release = cache.get('recent_release')
    if not recent_release:
        recent_release = DocumentRelease.objects.default().version
        cache.set(
            DocumentRelease.DEFAULT_CACHE_KEY,
            recent_release,
            settings.CACHE_MIDDLEWARE_SECONDS,
        )
    return {'RECENT_RELEASE': recent_release}
Something went wrong with that request. Please try again.