Use OccupationSerializer for the Contacts API
This commit is contained in:
+4
-4
@@ -108,15 +108,15 @@ class FeedViewSet(viewsets.ModelViewSet):
|
||||
|
||||
|
||||
class ContactsViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = Official.objects.all()
|
||||
serializer_class = ContactsSerializer
|
||||
queryset = Occupation.objects.all()
|
||||
serializer_class = OccupationSerializer
|
||||
permission_classes = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
def get_queryset(self):
|
||||
year = self.request.query_params.get('year')
|
||||
if not year:
|
||||
return Official.official_by_year(timezone.now().year)
|
||||
return Official.official_by_year(int(year))
|
||||
return Occupation.by_year(timezone.now().year)
|
||||
return Occupation.by_year(int(year))
|
||||
|
||||
|
||||
class TagsViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
||||
Reference in New Issue
Block a user