diff --git a/apps/location/views/back.py b/apps/location/views/back.py index 44385a9b..0203f73b 100644 --- a/apps/location/views/back.py +++ b/apps/location/views/back.py @@ -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)