mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2024-11-17 06:19:26 +08:00
14 lines
471 B
Python
14 lines
471 B
Python
|
from rest_framework.permissions import IsAuthenticated
|
||
|
from rest_framework import viewsets, generics
|
||
|
from .serializers import TransactionSerializer
|
||
|
from .models import Transaction
|
||
|
|
||
|
|
||
|
class TransactionViewSet(viewsets.ModelViewSet):
|
||
|
# Only allow GET, POST/CREATE
|
||
|
# Transactions cannot be deleted
|
||
|
http_method_names = ['get', 'post']
|
||
|
permission_classes = [IsAuthenticated]
|
||
|
serializer_class = TransactionSerializer
|
||
|
queryset = Transaction.objects.all()
|