|
|
@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
|
from rest_framework import generics |
|
|
from rest_framework import generics |
|
|
from rest_framework.exceptions import NotFound |
|
|
from rest_framework.exceptions import NotFound |
|
|
from drf_yasg.utils import swagger_auto_schema |
|
|
from drf_yasg.utils import swagger_auto_schema |
|
|
@ -15,8 +14,18 @@ from utils.pagination import StandardResultsSetPagination |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from rest_framework import serializers |
|
|
|
|
|
from django.db.models import Subquery, OuterRef |
|
|
|
|
|
|
|
|
|
|
|
class CourseParticipantSerializer(UserProfileSerializer): |
|
|
|
|
|
is_active = serializers.BooleanField(read_only=True) |
|
|
|
|
|
|
|
|
|
|
|
class Meta(UserProfileSerializer.Meta): |
|
|
|
|
|
fields = UserProfileSerializer.Meta.fields + ['is_active'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CourseParticipantsView(generics.ListAPIView): |
|
|
class CourseParticipantsView(generics.ListAPIView): |
|
|
serializer_class = UserProfileSerializer |
|
|
|
|
|
|
|
|
serializer_class = CourseParticipantSerializer |
|
|
pagination_class = StandardResultsSetPagination |
|
|
pagination_class = StandardResultsSetPagination |
|
|
|
|
|
|
|
|
@swagger_auto_schema( |
|
|
@swagger_auto_schema( |
|
|
@ -42,11 +51,6 @@ class CourseParticipantsView(generics.ListAPIView): |
|
|
).exclude( |
|
|
).exclude( |
|
|
email__exact='' # Extra safety just in case an email is a blank string |
|
|
email__exact='' # Extra safety just in case an email is a blank string |
|
|
).distinct() |
|
|
).distinct() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class ParticipantCreateView(generics.CreateAPIView): |
|
|
|
|
|
# queryset = StudentUser.objects.all() |
|
|
# queryset = StudentUser.objects.all() |
|
|
# serializer_class = ParticipantSerializer |
|
|
# serializer_class = ParticipantSerializer |
|
|
# permission_classes = [IsAuthenticated] |
|
|
# permission_classes = [IsAuthenticated] |
|
|
|