Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
alex 2020-02-04 17:19:18 +03:00
commit 0c87e3cd25

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.ListAPIView):
class CountryCallingCodeListView(APIView):
"""
## Country codes view.
### Response
@ -166,6 +167,5 @@ class CountryCallingCodeListView(generics.ListAPIView):
### 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)