Access VirtualMachineTemplates via api!
Serialization of VirtualMachineTemplates now fully works
This commit is contained in:
parent
5ed72bf4bf
commit
cbc13de34f
5 changed files with 180 additions and 59 deletions
|
|
@ -1,3 +1,18 @@
|
|||
from django.shortcuts import render
|
||||
from rest_framework import generics
|
||||
from .serializers import VirtualMachineTemplateSerializer
|
||||
from .models import VirtualMachineTemplate, OpenNebulaManager
|
||||
|
||||
# Create your views here.
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue