Skip to content

Instantly share code, notes, and snippets.

@elcolie
Created September 26, 2017 12:09
Show Gist options
  • Save elcolie/34fa66632209f14624899d997919d3fb to your computer and use it in GitHub Desktop.
Save elcolie/34fa66632209f14624899d997919d3fb to your computer and use it in GitHub Desktop.
viewsets.py
from rest_framework import status
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from soken_web.apps.uploaded_files.api.serializers import CustomerFromExcelSerializer
from soken_web.apps.uploaded_files.models import CustomerFromExcel
class CustomerFromExcelViewset(ModelViewSet):
queryset = CustomerFromExcel.objects.all()
serializer_class = CustomerFromExcelSerializer
def update(self, request, *args, **kwargs):
return Response({"message": "Method UPDATE not allowed"}, status=status.HTTP_405_METHOD_NOT_ALLOWED)
def partial_update(self, request, *args, **kwargs):
return Response({"message": "Method PATCH not allowed"}, status=status.HTTP_405_METHOD_NOT_ALLOWED)
def destroy(self, request, *args, **kwargs):
return Response({"message": "Method DELETE not allowed"}, status=status.HTTP_405_METHOD_NOT_ALLOWED)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment