diff options
authorDan McGee <>2014-01-11 13:37:12 -0600
committerDan McGee <>2014-01-11 13:37:12 -0600
commitfe37b46c50b60a8302e70ccef3ab34306fd8ea39 (patch)
parent3827215fa3335f8da3c82d4d098eb402b6d29dbc (diff)
Add a 'last_modified' function for mirror status pagesrelease_2014-01-11
We can use this on both the HTML and JSON views of this data to prevent recomputation for smart clients that respect the modified date header. Signed-off-by: Dan McGee <>
1 files changed, 7 insertions, 0 deletions
diff --git a/mirrors/ b/mirrors/
index 34336165..5429cea2 100644
--- a/mirrors/
+++ b/mirrors/
@@ -11,6 +11,7 @@ from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.timezone import now
from django.views.decorators.csrf import csrf_exempt
+from django.views.decorators.http import condition
from django_countries.countries import COUNTRIES
from .models import (Mirror, MirrorUrl, MirrorProtocol, MirrorLog,
@@ -220,6 +221,11 @@ def url_details(request, name, url_id):
return render(request, 'mirrors/url_details.html', context)
+def status_last_modified(request, *args, **kwargs):
+ return MirrorLog.objects.values_list('check_time', flat=True).latest()
def status(request, tier=None):
if tier is not None:
tier = int(tier)
@@ -297,6 +303,7 @@ class ExtendedMirrorStatusJSONEncoder(MirrorStatusJSONEncoder):
return super(ExtendedMirrorStatusJSONEncoder, self).default(obj)
def status_json(request, tier=None):
if tier is not None:
tier = int(tier)