blob: df6673087dc939e8487588eaa4a2c9804ef1f70c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
from rest_framework import serializers
from yaksh.models import (
Question, Quiz, QuestionPaper, AnswerPaper, Course,
LearningModule, LearningUnit, Lesson
)
class QuestionSerializer(serializers.ModelSerializer):
class Meta:
model = Question
fields = '__all__'
class QuizSerializer(serializers.ModelSerializer):
class Meta:
model = Quiz
fields = '__all__'
class QuestionPaperSerializer(serializers.ModelSerializer):
class Meta:
model = QuestionPaper
fields = '__all__'
class AnswerPaperSerializer(serializers.ModelSerializer):
questions = QuestionSerializer(many=True)
class Meta:
model = AnswerPaper
fields = '__all__'
class LessonSerializer(serializers.ModelSerializer):
class Meta:
model = Lesson
fields = '__all__'
class LearningUnitSerializer(serializers.ModelSerializer):
quiz = QuizSerializer()
lesson = LessonSerializer()
class Meta:
model = LearningUnit
fields = '__all__'
class LearningModuleSerializer(serializers.ModelSerializer):
learning_unit = LearningUnitSerializer(many=True)
class Meta:
model = LearningModule
fields = '__all__'
class CourseSerializer(serializers.ModelSerializer):
learning_module = LearningModuleSerializer(many=True)
class Meta:
model = Course
fields = '__all__'
|