added first public views - no check for access rights at the moment

This commit is contained in:
Holger Sielaff
2024-07-12 17:22:17 +02:00
parent 7d53df6ea5
commit 3640ab759d
22 changed files with 386 additions and 69 deletions

29
content/serializers.py Normal file
View 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
"""