summaryrefslogtreecommitdiff
path: root/api/serializers.py
diff options
context:
space:
mode:
Diffstat (limited to 'api/serializers.py')
-rw-r--r--api/serializers.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/api/serializers.py b/api/serializers.py
index d34f269..df66730 100644
--- a/api/serializers.py
+++ b/api/serializers.py
@@ -1,5 +1,8 @@
from rest_framework import serializers
-from yaksh.models import Question, Quiz, QuestionPaper, AnswerPaper
+from yaksh.models import (
+ Question, Quiz, QuestionPaper, AnswerPaper, Course,
+ LearningModule, LearningUnit, Lesson
+)
class QuestionSerializer(serializers.ModelSerializer):
@@ -21,6 +24,43 @@ class QuestionPaperSerializer(serializers.ModelSerializer):
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__'