forked from uncloud/uncloud
Rename / prepare for merge with uncloud repo
This commit is contained in:
parent
23203ff418
commit
7a6c8739f6
118 changed files with 1499 additions and 0 deletions
16
uncloud_django_based/uncloud/opennebula/views.py
Normal file
16
uncloud_django_based/uncloud/opennebula/views.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from rest_framework import viewsets, permissions
|
||||
|
||||
from .models import VM
|
||||
from .serializers import OpenNebulaVMSerializer
|
||||
|
||||
class VMViewSet(viewsets.ModelViewSet):
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
serializer_class = OpenNebulaVMSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
if self.request.user.is_superuser:
|
||||
obj = VM.objects.all()
|
||||
else:
|
||||
obj = VM.objects.filter(owner=self.request.user)
|
||||
|
||||
return obj
|
||||
Loading…
Add table
Add a link
Reference in a new issue