old_console/company/views/location_api.py
2024-11-02 14:12:45 +03:00

14 lines
466 B
Python

from rest_framework.response import Response
from rest_framework.views import APIView
from company.models.location import LocationCode
from company.serializers.location import LocationSerializer
class LocationCodeApi(APIView):
"""View for return location list"""
def get(self, request, *args, **kwargs) -> Response:
locations = LocationCode.objects.all()
data = LocationSerializer(locations, many=True).data
return Response(data)