xxxxxxxxxx
from rest_framework.generics import RetrieveAPIView
from myapp.models import MyModel
from myapp.serializers import MyModelSerializer
class MyModelDetailView(RetrieveAPIView):
queryset = MyModel.objects.all()
serializer_class = MyModelSerializer
lookup_field = 'id' # The field used for object lookup, in this case, the primary key