added first public views - no check for access rights at the moment
This commit is contained in:
29
content/serializers.py
Normal file
29
content/serializers.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import logging
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from content.models import Question, Label, Level
|
||||
|
||||
|
||||
class QuestionSerializer(serializers.Serializer):
|
||||
# question = serializers.CharField()
|
||||
# awnser = serializers.CharField()
|
||||
# buzzword = serializers.CharField(required=False)
|
||||
# level = serializers.IntegerField()
|
||||
# labels = serializers.MultipleChoiceField(choices=[(l.id, l.name) for l in Label.objects.all()], required=False)
|
||||
|
||||
class Meta:
|
||||
model = Question
|
||||
# fields = ['id', 'name', 'description', 'level', 'labels', 'medias', ]
|
||||
fields = '__all__'
|
||||
|
||||
"""
|
||||
def create(self, validated_data):
|
||||
return Question.objects.create(**validated_data)
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
instance.name = validated_data.get('name', instance.name)
|
||||
# ...
|
||||
instance.save()
|
||||
return instance
|
||||
"""
|
||||
Reference in New Issue
Block a user