Browse Source

Lock down views.

feature/python-error-tracking
Drew Larson 9 years ago
parent
commit
9c0ac0dc05
  1. 12
      bikeshop_project/registration/views.py

12
bikeshop_project/registration/views.py

@ -1,6 +1,7 @@
import json import json
import logging import logging
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
@ -8,21 +9,20 @@ from django.template.response import TemplateResponse
from django.utils import timezone from django.utils import timezone
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View from django.views.generic import TemplateView, View
from django.views.generic import TemplateView from rest_framework.renderers import JSONRenderer
from rest_framework.serializers import ModelSerializer
from core.models import Visit from core.models import Visit
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
from rest_framework.serializers import ModelSerializer
from rest_framework.renderers import JSONRenderer
from .forms import MemberForm from .forms import MemberForm
from .models import Member from .models import Member
logger = logging.getLogger('bikeshop') logger = logging.getLogger('bikeshop')
@method_decorator(login_required, name='dispatch')
class MemberFormView(View): class MemberFormView(View):
def get(self, request, member_id=None): def get(self, request, member_id=None):
try: try:
@ -105,6 +105,8 @@ class MemberSignIn(View):
return JsonResponse(data=json.decode(), safe=False, status=200) return JsonResponse(data=json.decode(), safe=False, status=200)
@method_decorator(login_required, name='dispatch')
class Members(TemplateView): class Members(TemplateView):
template_name = 'members.html' template_name = 'members.html'

Loading…
Cancel
Save