Commit c35d0d65 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Update details for class serializer

parent a2ebbcaa
......@@ -39,7 +39,7 @@ class CourseStudentClassSerializer(serializers.ModelSerializer):
class ClassSerializer(WorkspaceBaseSerializerMixin, serializers.ModelSerializer):
enrolled_students = CourseStudentClassSerializer(source='get_students', many=True, read_only=True)
students_details = SimpleUserSerializer(source='valid_students', many=True, read_only=True)
students_details = serializers.SerializerMethodField('get_students_serializer')
processes = CertificationProcessSerializer(read_only=True, many=True)
evaluations = EvaluationSerializer(read_only=True, many=True)
course = BasicCourseSerializer(read_only=True)
......@@ -68,4 +68,9 @@ class ClassSerializer(WorkspaceBaseSerializerMixin, serializers.ModelSerializer)
updated_class.contract.clear()
updated_class.save()
return updated_class
\ No newline at end of file
return updated_class
def get_students_serializer(self, obj):
serializer_context = { 'course_id': obj.id }
serializer = SimpleUserSerializer(obj.valid_students, many=True, read_only=True, context=serializer_context)
return serializer.data
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment