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