From 2b5fdacadc4438dcfd7df85683f7ed0dd4a5be78 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 21 Nov 2013 04:07:27 +0100 Subject: [PATCH] status view is expensive (DB accesses to build statistics), make it logged-in only --- nsupdate/main/_tests/test_main.py | 2 +- nsupdate/main/views.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nsupdate/main/_tests/test_main.py b/nsupdate/main/_tests/test_main.py index 75fcb7c..b283b37 100644 --- a/nsupdate/main/_tests/test_main.py +++ b/nsupdate/main/_tests/test_main.py @@ -17,7 +17,7 @@ def test_views_anon(client): ('about', dict(), 200), ('legal', dict(), 200), ('robots', dict(), 200), - ('status', dict(), 200), # TODO make this require a login + ('status', dict(), 302), ('overview', dict(), 302), # stuff that requires a log in redirects to the login view: ('domain_overview', dict(), 302), diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index f56d334..b5bc326 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -88,6 +88,10 @@ class HomeView(TemplateView): class StatusView(TemplateView): template_name = "main/status.html" + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super(StatusView, self).dispatch(*args, **kwargs) + def get_context_data(self, *args, **kwargs): context = super( StatusView, self).get_context_data(*args, **kwargs)