Re-add implementation of multiple-operation generic views to remove diamond inheritance

This commit is contained in:
Jamie Matthews 2012-10-25 12:26:08 +01:00
parent 16e249d60d
commit d6e10b50fc

View File

@ -144,23 +144,44 @@ class UpdateAPIView(mixins.UpdateModelMixin,
return self.update(request, *args, **kwargs) return self.update(request, *args, **kwargs)
class ListCreateAPIView(ListAPIView, class ListCreateAPIView(mixins.ListModelMixin,
CreateAPIView): mixins.CreateModelMixin,
MultipleObjectBaseView):
""" """
Concrete view for listing a queryset or creating a model instance. Concrete view for listing a queryset or creating a model instance.
""" """
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 RetrieveDestroyAPIView(RetrieveAPIView, class RetrieveDestroyAPIView(mixins.RetrieveModelMixin,
DestroyAPIView): mixins.DestroyModelMixin,
SingleObjectBaseView):
""" """
Concrete view for retrieving or deleting a model instance. Concrete view for retrieving or deleting a model instance.
""" """
def get(self, request, *args, **kwargs):
return self.retrieve(request, *args, **kwargs)
def delete(self, request, *args, **kwargs):
return self.destroy(request, *args, **kwargs)
class RetrieveUpdateDestroyAPIView(RetrieveAPIView, class RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin,
UpdateAPIView, mixins.UpdateModelMixin,
DestroyAPIView): mixins.DestroyModelMixin,
SingleObjectBaseView):
""" """
Concrete view for retrieving, updating or deleting a model instance. Concrete view for retrieving, updating or deleting a model instance.
""" """
def get(self, request, *args, **kwargs):
return self.retrieve(request, *args, **kwargs)
def put(self, request, *args, **kwargs):
return self.update(request, *args, **kwargs)
def delete(self, request, *args, **kwargs):
return self.destroy(request, *args, **kwargs)