|
|
@@ -1,11 +1,15 @@ |
|
|
|
from rest_framework.response import Response |
|
|
|
from rest_framework.views import APIView |
|
|
|
|
|
|
|
from rest_framework.authentication import TokenAuthentication |
|
|
|
from rest_framework.permissions import IsAuthenticated |
|
|
|
from .models import TaxType, Country, State, City, Client |
|
|
|
from .serializers import TaxTypeSerializer, CountrySerializer, StateSerializer, CitySerializer, ClientSerializer |
|
|
|
|
|
|
|
|
|
|
|
class TaxTypeList(APIView): |
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
tax_types = TaxType.objects.all() |
|
|
|
serializer = TaxTypeSerializer(tax_types, many=True) |
|
|
@@ -13,6 +17,9 @@ class TaxTypeList(APIView): |
|
|
|
|
|
|
|
|
|
|
|
class CountryList(APIView): |
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
countries = Country.objects.all() |
|
|
|
serializer = CountrySerializer(countries, many=True) |
|
|
@@ -20,6 +27,9 @@ class CountryList(APIView): |
|
|
|
|
|
|
|
|
|
|
|
class StateList(APIView): |
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
states = State.objects.all() |
|
|
|
serializer = StateSerializer(states, many=True) |
|
|
@@ -27,6 +37,9 @@ class StateList(APIView): |
|
|
|
|
|
|
|
|
|
|
|
class CityList(APIView): |
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
cities = City.objects.all() |
|
|
|
serializer = CitySerializer(cities, many=True) |
|
|
@@ -34,6 +47,9 @@ class CityList(APIView): |
|
|
|
|
|
|
|
|
|
|
|
class ClientList(APIView): |
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
permission_classes = [IsAuthenticated] |
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
clients = Client.objects.all() |
|
|
|
serializer = ClientSerializer(clients, many=True) |
|
|
|