This commit is contained in:
Anatoly 2020-02-04 17:16:31 +03:00
parent b7a84a147c
commit 37eef69ee2

View File

@ -2,6 +2,7 @@
from django.contrib.postgres.fields.jsonb import KeyTextTransform
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.views import APIView
from location import filters
from location import models, serializers
@ -131,7 +132,7 @@ class CountryRUDView(CountryBaseViewMixin, generics.RetrieveUpdateDestroyAPIView
serializer_class = serializers.CountryBackSerializer
class CountryCallingCodeListView(generics.GenericAPIView):
class CountryCallingCodeListView(APIView):
"""
## Country codes view.
### Response
@ -166,6 +167,5 @@ class CountryCallingCodeListView(generics.GenericAPIView):
### Description
Return an array of unique country code for all countries in a database.
"""
return Response(models.Country.objects.only('calling_code')
.aggregate_country_codes(),
return Response(data=models.Country.objects.aggregate_country_codes(),
status=status.HTTP_200_OK)