Set authentication to webapp DRF
This commit is contained in:
@@ -14,6 +14,8 @@ requests==2.11.1
|
||||
django-nocaptcha-recaptcha==0.0.19
|
||||
django-cors-headers==2.0.1
|
||||
djangorestframework==3.8.2
|
||||
PyJWT==1.6.4
|
||||
djangorestframework-jwt==1.11.0
|
||||
coverage==4.3.4
|
||||
django-nose==1.4.5
|
||||
nose-exclude==0.5.0
|
||||
|
||||
+2
-1
@@ -96,6 +96,7 @@ INSTALLED_APPS = [
|
||||
'kaehmy',
|
||||
'ohlhafv',
|
||||
'rest_framework',
|
||||
'rest_framework_jwt',
|
||||
'django_nose',
|
||||
'bootstrap3',
|
||||
'django_tables2',
|
||||
@@ -221,7 +222,7 @@ REST_FRAMEWORK = {
|
||||
'rest_framework.permissions.IsAdminUser',
|
||||
),
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
|
||||
),
|
||||
'DEFAULT_THROTTLE_CLASSES': (
|
||||
'members.throttles.BurstRateThrottle',
|
||||
|
||||
+7
-1
@@ -10,7 +10,7 @@ from django.views.decorators.http import require_http_methods
|
||||
# from django.conf import settings
|
||||
# from django.utils import timezone
|
||||
from rest_framework import viewsets
|
||||
# from rest_framework import permissions, authentication
|
||||
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
@@ -29,31 +29,37 @@ from members.views.utils import *
|
||||
class EventViewSet(viewsets.ModelViewSet):
|
||||
queryset = Event.objects.all()
|
||||
serializer_class = EventSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
class SignupFormViewSet(viewsets.ModelViewSet):
|
||||
queryset = SignupForm.objects.all()
|
||||
serializer_class = SignupFormSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
class SignupViewSet(viewsets.ModelViewSet):
|
||||
queryset = Signup.objects.all()
|
||||
serializer_class = SignupSerializer
|
||||
permission_classes = []
|
||||
|
||||
|
||||
class SavedQuestionsViewSet(viewsets.ModelViewSet):
|
||||
queryset = TemplateQuestion.objects.all()
|
||||
serializer_class = SavedQuestionsSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
class FeedViewSet(viewsets.ModelViewSet):
|
||||
queryset = Feed.objects.all()
|
||||
serializer_class = FeedSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
class ContactsViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = Official.objects.all()
|
||||
serializer_class = ContactsSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
# -- OLD CODEBASE -- #
|
||||
|
||||
Reference in New Issue
Block a user