diff options
author | CruiseDevice | 2020-03-30 18:55:50 +0530 |
---|---|---|
committer | CruiseDevice | 2020-03-30 18:55:50 +0530 |
commit | 17e77e3d7ba5595a1d24004f886192ea2bb3f600 (patch) | |
tree | 7f767adf84c930dc906a33c1959e56d0e41b4aaa /api/serializers.py | |
parent | e8573822d3ed25306d5d2faf946633f2c17997b0 (diff) | |
parent | a7b4b9e0c6699987d1dee4007e9c62da15559432 (diff) | |
download | online_test-17e77e3d7ba5595a1d24004f886192ea2bb3f600.tar.gz online_test-17e77e3d7ba5595a1d24004f886192ea2bb3f600.tar.bz2 online_test-17e77e3d7ba5595a1d24004f886192ea2bb3f600.zip |
Resolve Conflicts
Merge branch 'api' of https://github.com/prathamesh920/online_test into API
Diffstat (limited to 'api/serializers.py')
-rw-r--r-- | api/serializers.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/api/serializers.py b/api/serializers.py new file mode 100644 index 0000000..df66730 --- /dev/null +++ b/api/serializers.py @@ -0,0 +1,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__' |