diff --git a/membershipworks/api.py b/membershipworks/api.py index c34214d..b47defa 100644 --- a/membershipworks/api.py +++ b/membershipworks/api.py @@ -1,6 +1,6 @@ from rest_framework import routers, serializers, viewsets -from .models import Member, MemberFlag, Flag +from .models import Member, Flag class MemberSerializer(serializers.HyperlinkedModelSerializer): @@ -10,7 +10,7 @@ class MemberSerializer(serializers.HyperlinkedModelSerializer): class MemberViewSet(viewsets.ModelViewSet): - queryset = Member.objects.all() + queryset = Member.objects.prefetch_related("flags") serializer_class = MemberSerializer diff --git a/paperwork/api.py b/paperwork/api.py index 8b5a991..ba6812c 100644 --- a/paperwork/api.py +++ b/paperwork/api.py @@ -103,7 +103,7 @@ class DepartmentViewSet(viewsets.ModelViewSet): class CertificationDefinitionSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = CertificationDefinition - fields = ["certification_name", "department", "mailing_list"] + fields = ["certification_name", "department"] class CertificationDefinitionViewSet(viewsets.ModelViewSet):