<commit_before>from rest_framework import serializers

from quiz.models import Quiz, ShortAnswer, Choice
from core.serializers import TagSerializer

class ShortAnswerSerializer(serializers.ModelSerializer):

    class Meta:
        model = ShortAnswer
        fields = ('id', 'answer', 'created_at')


class ChoiceSerializer(serializers.ModelSerializer):

    class Meta:
        model = Choice
        fields = ('id', 'choice_input', 'choice_display', 'is_correct', 'created_at')

class QuizSerializer(serializers.ModelSerializer):

    answers = ShortAnswerSerializer(source="shortanswer_set", many=True)<commit_msg>Removed created_at field from API for choices and answers, since the field is already present in the associated quiz. But the created_at field is present in the db for auditing purposes.<commit_after>from rest_framework import serializers

from quiz.models import Quiz, ShortAnswer, Choice
from core.serializers import TagSerializer

class ShortAnswerSerializer(serializers.ModelSerializer):

    class Meta:
        model = ShortAnswer
        fields = ('id', 'answer')


class ChoiceSerializer(serializers.ModelSerializer):

    class Meta:
        model = Choice
        fields = ('id', 'choice_input', 'choice_display', 'is_correct')

class QuizSerializer(serializers.ModelSerializer):

    answers = ShortAnswerSerializer(source="shortanswer_set", many=True)
{'fraction_non_alphanumeric': 0.0832729905865315, 'fraction_numerical': 0.0, 'mean_word_length': 4.8808510638297875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4417127', 'n_tokens_mistral': 364, 'n_tokens_neox': 345, 'n_words': 109}