17 lines
578 B
Python
17 lines
578 B
Python
from rest_framework import viewsets
|
|
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
|
|
|
from .models import Purchase, PurchaseTag
|
|
from .serializers import PurchaseSerializer, PurchaseTagSerializer
|
|
|
|
|
|
class PurchaseTagViewSet(viewsets.ModelViewSet):
|
|
queryset = PurchaseTag.objects.all()
|
|
serializer_class = PurchaseTagSerializer
|
|
permission_class = [IsAuthenticatedOrReadOnly]
|
|
|
|
|
|
class PurchaseViewSet(viewsets.ModelViewSet):
|
|
queryset = Purchase.objects.all()
|
|
serializer_class = PurchaseSerializer
|
|
permission_class = [IsAuthenticatedOrReadOnly]
|