cbc13de34f
Serialization of VirtualMachineTemplates now fully works
18 lines
761 B
Python
18 lines
761 B
Python
from rest_framework import generics
|
|
from .serializers import VirtualMachineTemplateSerializer
|
|
from .models import VirtualMachineTemplate, OpenNebulaManager
|
|
|
|
class TemplateCreateView(generics.ListCreateAPIView):
|
|
"""This class defines the create behavior of our rest api."""
|
|
queryset = VirtualMachineTemplate.objects.all()
|
|
serializer_class = VirtualMachineTemplateSerializer
|
|
|
|
def perform_create(self, serializer):
|
|
"""Save the post data when creating a new template."""
|
|
serializer.save()
|
|
|
|
class TemplateDetailsView(generics.RetrieveUpdateDestroyAPIView):
|
|
"""This class handles the http GET, PUT and DELETE requests."""
|
|
|
|
queryset = VirtualMachineTemplate.objects.all()
|
|
serializer_class = VirtualMachineTemplateSerializer
|