From c1e92efd2f4f8ac5fbdac273c94aa3a6ac6e084f Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 23 Jun 2016 17:37:44 -0600 Subject: [PATCH] Protect view. --- bikeshop_project/core/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bikeshop_project/core/views.py b/bikeshop_project/core/views.py index 4cd330d..8c1bc97 100644 --- a/bikeshop_project/core/views.py +++ b/bikeshop_project/core/views.py @@ -5,6 +5,8 @@ from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.template.response import TemplateResponse from django.views.generic import TemplateView, View +from django.utils.decorators import method_decorator +from django.contrib.auth.decorators import login_required from registration.models import Member @@ -13,11 +15,12 @@ from .forms import MembershipForm, PaymentForm logger = logging.getLogger(__name__) +@method_decorator(login_required, name='dispatch') class DashboardView(View): def get(self, request): return TemplateResponse(request, 'dashboard.html') - +@method_decorator(login_required, name='dispatch') class NewMembershipView(TemplateView): template_name = 'membership_form.html'