vbv/server/vbv_lernwelt/learnpath/serializers.py

22 lines
585 B
Python

from vbv_lernwelt.competence.serializers import (
PerformanceCriteriaLearningPathSerializer,
)
from vbv_lernwelt.learnpath.models import LearningUnit
from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class
class LearningUnitSerializer(
get_it_serializer_class(
LearningUnit,
[
"course_category",
"children",
],
)
):
def get_children(self, obj):
return [
PerformanceCriteriaLearningPathSerializer(child).data
for child in obj.performancecriteria_set.all()
]