api/task/views.py
from .models import Task
from rest_framework import generics
from .serializers import TaskSerializer
class TaskCreate(generics.CreateAPIView):
queryset = Task.objects.all(),
serializer_class = TaskSerializer
class TaskList(generics.ListAPIView):
queryset = Task.objects.all()
serializer_class = TaskSerializer
class TaskDetail(generics.RetrieveAPIView):
queryset = Task.objects.all()
serializer_class = TaskSerializer
class TaskUpdate(generics.RetrieveUpdateAPIView):
queryset = Task.objects.all()
serializer_class = TaskSerializer
class TaskDelete(generics.RetrieveDestroyAPIView):
queryset = Task.objects.all()
serializer_class = TaskSerializer