status view is expensive (DB accesses to build statistics), make it logged-in only

This commit is contained in:
Thomas Waldmann 2013-11-21 04:07:27 +01:00
parent ae9c2f29d0
commit 2b5fdacadc
2 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,7 @@ def test_views_anon(client):
('about', dict(), 200), ('about', dict(), 200),
('legal', dict(), 200), ('legal', dict(), 200),
('robots', dict(), 200), ('robots', dict(), 200),
('status', dict(), 200), # TODO make this require a login ('status', dict(), 302),
('overview', dict(), 302), ('overview', dict(), 302),
# stuff that requires a log in redirects to the login view: # stuff that requires a log in redirects to the login view:
('domain_overview', dict(), 302), ('domain_overview', dict(), 302),

View File

@ -88,6 +88,10 @@ class HomeView(TemplateView):
class StatusView(TemplateView): class StatusView(TemplateView):
template_name = "main/status.html" 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): def get_context_data(self, *args, **kwargs):
context = super( context = super(
StatusView, self).get_context_data(*args, **kwargs) StatusView, self).get_context_data(*args, **kwargs)