123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- from __future__ import unicode_literals, print_function
- from rest_framework import mixins
- from rest_framework.generics import GenericAPIView
- from . import mixins as bulk_mixins
- ##########################################################
- ### Concrete view classes that provide method handlers ###
- ### by composing the mixin classes with the base view. ###
- ##########################################################
- class BulkCreateAPIView(bulk_mixins.BulkCreateModelMixin,
- GenericAPIView):
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- class BulkUpdateAPIView(bulk_mixins.BulkUpdateModelMixin,
- GenericAPIView):
- def put(self, request, *args, **kwargs):
- return self.bulk_update(request, *args, **kwargs)
- def patch(self, request, *args, **kwargs):
- return self.partial_bulk_update(request, *args, **kwargs)
- class BulkDestroyAPIView(bulk_mixins.BulkDestroyModelMixin,
- GenericAPIView):
- def delete(self, request, *args, **kwargs):
- return self.bulk_destroy(request, *args, **kwargs)
- class ListBulkCreateAPIView(mixins.ListModelMixin,
- bulk_mixins.BulkCreateModelMixin,
- GenericAPIView):
- def get(self, request, *args, **kwargs):
- return self.list(request, *args, **kwargs)
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- class ListCreateBulkUpdateAPIView(mixins.ListModelMixin,
- mixins.CreateModelMixin,
- bulk_mixins.BulkUpdateModelMixin,
- GenericAPIView):
- def get(self, request, *args, **kwargs):
- return self.list(request, *args, **kwargs)
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- def put(self, request, *args, **kwargs):
- return self.bulk_update(request, *args, **kwargs)
- def patch(self, request, *args, **kwargs):
- return self.partial_bulk_update(request, *args, **kwargs)
- class ListCreateBulkUpdateDestroyAPIView(mixins.ListModelMixin,
- mixins.CreateModelMixin,
- bulk_mixins.BulkUpdateModelMixin,
- bulk_mixins.BulkDestroyModelMixin,
- GenericAPIView):
- def get(self, request, *args, **kwargs):
- return self.list(request, *args, **kwargs)
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- def put(self, request, *args, **kwargs):
- return self.bulk_update(request, *args, **kwargs)
- def patch(self, request, *args, **kwargs):
- return self.partial_bulk_update(request, *args, **kwargs)
- def delete(self, request, *args, **kwargs):
- return self.bulk_destroy(request, *args, **kwargs)
- class ListBulkCreateUpdateAPIView(mixins.ListModelMixin,
- bulk_mixins.BulkCreateModelMixin,
- bulk_mixins.BulkUpdateModelMixin,
- GenericAPIView):
- def get(self, request, *args, **kwargs):
- return self.list(request, *args, **kwargs)
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- def put(self, request, *args, **kwargs):
- return self.bulk_update(request, *args, **kwargs)
- def patch(self, request, *args, **kwargs):
- return self.partial_bulk_update(request, *args, **kwargs)
- class ListBulkCreateUpdateDestroyAPIView(mixins.ListModelMixin,
- bulk_mixins.BulkCreateModelMixin,
- bulk_mixins.BulkUpdateModelMixin,
- bulk_mixins.BulkDestroyModelMixin,
- GenericAPIView):
- def get(self, request, *args, **kwargs):
- return self.list(request, *args, **kwargs)
- def post(self, request, *args, **kwargs):
- return self.create(request, *args, **kwargs)
- def put(self, request, *args, **kwargs):
- return self.bulk_update(request, *args, **kwargs)
- def patch(self, request, *args, **kwargs):
- return self.partial_bulk_update(request, *args, **kwargs)
- def delete(self, request, *args, **kwargs):
- return self.bulk_destroy(request, *args, **kwargs)
|