Не могу понять в чем разница между viewsets.ModelViewSet и generics.ListCreateAPIView?
Оба дают один и тот же результат.
from django.http import HttpResponse
from .models import Personal
from rest_framework import serializers
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework import generics
# Create your views here.
class PersonalSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Personal
fields = ['firstname', 'lastname', 'surname']
#class PersonalViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
#queryset = Personal.objects.all()
#serializer_class = PersonalSerializer
#def list(self,request):
#return Response({"user":1})
class PersonalList(generics.ListCreateAPIView):
queryset = Personal.objects.all()
serializer_class = PersonalSerializer