We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abb7781 commit 42609abCopy full SHA for 42609ab
classroom/serializers/question.py
@@ -6,7 +6,7 @@
6
7
class ReadingQuestionSerializer(serializers.HyperlinkedModelSerializer):
8
choices = serializers.ListField(source='get_choices_content')
9
- answers = serializers.SerializerMethodField()
+ answers = serializers.ListField(source='get_answers_content')
10
11
class Meta:
12
model = ReadingQuestion
@@ -22,13 +22,6 @@ class Meta:
22
'number': {'min_value': 1},
23
}
24
25
- def get_answers(self, question):
26
- user = self.context['request'].user
27
- if user.is_teacher():
28
- return question.get_answers_content()
29
- else:
30
- return [] # Of course we can't allow student to see the answers
31
-
32
def validate(self, attrs):
33
attrs = super().validate(attrs)
34
self._validate_question_not_exist(attrs)
0 commit comments