Skip to content

Commit

Permalink
Return it anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebrownlee committed Jul 23, 2024
1 parent 28c8275 commit 8d999ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions LearningAPI/views/student_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ def list(self, request):

serializer = CohortStudentSerializer(data=students, many=True)

return Response(serializer.data, status=status.HTTP_200_OK)
if serializer.is_valid():
return Response(serializer.data, status=status.HTTP_200_OK)
else:
return Response(serializer.data, status=status.HTTP_200_OK)
# return Response({'message': serializer.error_messages}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

@action(methods=['post', 'put'], detail=True)
def assess(self, request, pk):
Expand Down Expand Up @@ -557,8 +561,8 @@ class Meta:

class CohortStudentSerializer(serializers.Serializer):
"""JSON serializer"""
github_handle = serializers.CharField(max_length=100)
id = serializers.IntegerField()
github_handle = serializers.CharField(max_length=100)
name = serializers.CharField(max_length=100)
current_cohort = serializers.DictField()
avatar = serializers.CharField(allow_blank=True, allow_null=True)
Expand Down

0 comments on commit 8d999ba

Please sign in to comment.