Minor fixes/optimizations for API endpoints
This commit is contained in:
parent
efe476b367
commit
8556190117
@ -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
|
||||
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user