mirror of https://gitlab.crans.org/bde/nk20
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
|
# -*- mode: python; coding: utf-8 -*-
|
||
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
||
|
from .models import ActivityType, Activity, Guest
|
||
|
from rest_framework import serializers, viewsets
|
||
|
|
||
|
class ActivityTypeSerializer(serializers.HyperlinkedModelSerializer):
|
||
|
class Meta:
|
||
|
model = ActivityType
|
||
|
fields = '__all__'
|
||
|
|
||
|
|
||
|
class ActivityTypeViewSet(viewsets.ModelViewSet):
|
||
|
queryset = ActivityType.objects.all()
|
||
|
serializer_class = ActivityTypeSerializer
|
||
|
|
||
|
|
||
|
class ActivitySerializer(serializers.HyperlinkedModelSerializer):
|
||
|
class Meta:
|
||
|
model = Activity
|
||
|
fields = '__all__'
|
||
|
|
||
|
|
||
|
class ActivityViewSet(viewsets.ModelViewSet):
|
||
|
queryset = Activity.objects.all()
|
||
|
serializer_class = ActivitySerializer
|
||
|
|
||
|
|
||
|
class GuestSerializer(serializers.HyperlinkedModelSerializer):
|
||
|
class Meta:
|
||
|
model = Guest
|
||
|
fields = '__all__'
|
||
|
|
||
|
|
||
|
class GuestViewSet(viewsets.ModelViewSet):
|
||
|
queryset = Guest.objects.all()
|
||
|
serializer_class = GuestSerializer
|