nk20/apps/member/serializers.py

47 lines
1.1 KiB
Python
Raw Normal View History

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