nk20/apps/activity/api/serializers.py

37 lines
1.0 KiB
Python
Raw Normal View History

2020-02-07 16:02:07 +00:00
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
2020-02-18 10:58:42 +00:00
from ..models import ActivityType, Activity, Guest
2020-02-07 16:02:07 +00:00
from rest_framework import serializers
2020-02-18 11:31:15 +00:00
2020-02-07 19:47:49 +00:00
class ActivityTypeSerializer(serializers.ModelSerializer):
2020-02-07 16:02:07 +00:00
"""
REST API Serializer for Activity types.
The djangorestframework plugin will analyse the model `ActivityType` and parse all fields in the API.
"""
class Meta:
model = ActivityType
fields = '__all__'
2020-02-07 19:47:49 +00:00
class ActivitySerializer(serializers.ModelSerializer):
2020-02-07 16:02:07 +00:00
"""
REST API Serializer for Activities.
The djangorestframework plugin will analyse the model `Activity` and parse all fields in the API.
"""
class Meta:
model = Activity
fields = '__all__'
2020-02-07 19:47:49 +00:00
class GuestSerializer(serializers.ModelSerializer):
2020-02-07 16:02:07 +00:00
"""
REST API Serializer for Guests.
The djangorestframework plugin will analyse the model `Guest` and parse all fields in the API.
"""
class Meta:
model = Guest
fields = '__all__'