mirror of https://gitlab.crans.org/bde/nk20
51 lines
1.2 KiB
Python
51 lines
1.2 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 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
|
|
|