|
|
|
|
@ -14,7 +14,7 @@ from .serializers import ( |
|
|
|
|
GallerySerializer, GalleryImageSerializer, GalleryImageCreateSerializer, |
|
|
|
|
UserSerializer, UserPhotoSerializer, |
|
|
|
|
LessonSerializer, CourseCreateSerializer, |
|
|
|
|
ImageObjectSerializer, |
|
|
|
|
ImageObjectSerializer, LessonCreateSerializer, |
|
|
|
|
) |
|
|
|
|
from .permissions import IsAdmin, IsAdminOrIsSelf, IsAuthorOrAdmin, IsAuthorObjectOrAdmin |
|
|
|
|
|
|
|
|
|
@ -82,7 +82,11 @@ class LessonViewSet(ExtendedModelViewSet): |
|
|
|
|
queryset = Lesson.objects.select_related( |
|
|
|
|
'course', 'cover' |
|
|
|
|
).prefetch_related('content').all() |
|
|
|
|
serializer_class = LessonSerializer |
|
|
|
|
serializer_class = LessonCreateSerializer |
|
|
|
|
serializer_class_map = { |
|
|
|
|
'list': LessonSerializer, |
|
|
|
|
'retrieve': LessonSerializer, |
|
|
|
|
} |
|
|
|
|
filter_fields = ('course',) |
|
|
|
|
search_fields = ('title', 'short_description',) |
|
|
|
|
ordering_fields = ('title', 'created_at', 'update_at',) |
|
|
|
|
|