|
|
@ -4,6 +4,7 @@ from rest_framework.permissions import IsAuthenticated, IsAdminUser |
|
|
from rest_framework.authentication import TokenAuthentication |
|
|
from rest_framework.authentication import TokenAuthentication |
|
|
from rest_framework.decorators import action |
|
|
from rest_framework.decorators import action |
|
|
from rest_framework.response import Response |
|
|
from rest_framework.response import Response |
|
|
|
|
|
from utils.pagination import StandardResultsSetPagination |
|
|
from apps.course.models import ( |
|
|
from apps.course.models import ( |
|
|
Course, |
|
|
Course, |
|
|
CourseCategory, |
|
|
CourseCategory, |
|
|
@ -39,6 +40,7 @@ class AdminCourseViewSet(viewsets.ModelViewSet): |
|
|
""" |
|
|
""" |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_serializer_class(self): |
|
|
def get_serializer_class(self): |
|
|
if self.action == 'list': |
|
|
if self.action == 'list': |
|
|
@ -216,6 +218,7 @@ class AdminCourseCategoryViewSet(viewsets.ModelViewSet): |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
serializer_class = AdminCourseCategorySerializer |
|
|
serializer_class = AdminCourseCategorySerializer |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
def get_queryset(self): |
|
|
queryset = CourseCategory.objects.all().order_by('-id') |
|
|
queryset = CourseCategory.objects.all().order_by('-id') |
|
|
@ -232,6 +235,7 @@ class AdminLessonViewSet(viewsets.ModelViewSet): |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
serializer_class = AdminLessonSerializer |
|
|
serializer_class = AdminLessonSerializer |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
def get_queryset(self): |
|
|
queryset = Lesson.objects.all().order_by('-id') |
|
|
queryset = Lesson.objects.all().order_by('-id') |
|
|
@ -253,6 +257,7 @@ class AdminGlossaryViewSet(viewsets.ModelViewSet): |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
serializer_class = AdminGlossarySerializer |
|
|
serializer_class = AdminGlossarySerializer |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
def get_queryset(self): |
|
|
queryset = Glossary.objects.all().order_by('-id') |
|
|
queryset = Glossary.objects.all().order_by('-id') |
|
|
@ -269,6 +274,7 @@ class AdminAttachmentViewSet(viewsets.ModelViewSet): |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
serializer_class = AdminAttachmentSerializer |
|
|
serializer_class = AdminAttachmentSerializer |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
def get_queryset(self): |
|
|
queryset = Attachment.objects.all().order_by('-id') |
|
|
queryset = Attachment.objects.all().order_by('-id') |
|
|
@ -284,6 +290,7 @@ class AdminLiveSessionViewSet(viewsets.ModelViewSet): |
|
|
""" |
|
|
""" |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
permission_classes = [IsAuthenticated, IsAdminUser] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
def get_serializer_class(self): |
|
|
def get_serializer_class(self): |
|
|
if self.action == 'list': |
|
|
if self.action == 'list': |
|
|
|