nk20/apps/member/serializers.py

51 lines
1.2 KiB
Python
Raw Normal View History

2020-02-06 22:44:59 +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-06 22:43:56 +00:00
from .models import Profile, Club, Role, Membership
from rest_framework import serializers, viewsets
class ProfileSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Profile
fields = '__all__'
class ProfileViewSet(viewsets.ModelViewSet):
queryset = Profile.objects.all()
serializer_class = ProfileSerializer
class ClubSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Club
fields = '__all__'
class ClubViewSet(viewsets.ModelViewSet):
queryset = Club.objects.all()
serializer_class = ClubSerializer
class RoleSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Role
fields = '__all__'
class RoleViewSet(viewsets.ModelViewSet):
queryset = Role.objects.all()
serializer_class = RoleSerializer
class MembershipSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Membership
fields = '__all__'
class MembershipViewSet(viewsets.ModelViewSet):
queryset = Membership.objects.all()
serializer_class = MembershipSerializer