1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-30 04:13:01 +00:00
nk20/apps/activity/api/views.py

38 lines
1.2 KiB
Python
Raw Normal View History

2020-02-06 22:49:33 +00:00
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from rest_framework import viewsets
2020-02-18 10:58:42 +00:00
from ..models import ActivityType, Activity, Guest
2020-02-07 16:02:07 +00:00
from .serializers import ActivityTypeSerializer, ActivitySerializer, GuestSerializer
2020-02-06 22:49:33 +00:00
class ActivityTypeViewSet(viewsets.ModelViewSet):
2020-02-06 23:29:04 +00:00
"""
REST API View set.
The djangorestframework plugin will get all `ActivityType` objects, serialize it to JSON with the given serializer,
then render it on /api/activity/type/
"""
2020-02-06 22:49:33 +00:00
queryset = ActivityType.objects.all()
serializer_class = ActivityTypeSerializer
class ActivityViewSet(viewsets.ModelViewSet):
2020-02-06 23:29:04 +00:00
"""
REST API View set.
The djangorestframework plugin will get all `Activity` objects, serialize it to JSON with the given serializer,
then render it on /api/activity/activity/
"""
2020-02-06 22:49:33 +00:00
queryset = Activity.objects.all()
serializer_class = ActivitySerializer
class GuestViewSet(viewsets.ModelViewSet):
2020-02-06 23:29:04 +00:00
"""
REST API View set.
The djangorestframework plugin will get all `Guest` objects, serialize it to JSON with the given serializer,
then render it on /api/activity/guest/
"""
2020-02-06 22:49:33 +00:00
queryset = Guest.objects.all()
serializer_class = GuestSerializer