Phasing out Product model
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
1aead50170
commit
c6bacab35a
12 changed files with 227 additions and 26 deletions
25
opennebula/migrations/0006_auto_20200928_1858.py
Normal file
25
opennebula/migrations/0006_auto_20200928_1858.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 3.1 on 2020-09-28 18:58
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('opennebula', '0005_remove_vm_orders'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='vm',
|
||||
name='extra_data',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='vm',
|
||||
name='owner',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='vm',
|
||||
name='status',
|
||||
),
|
||||
]
|
||||
|
|
@ -10,7 +10,7 @@ storage_class_mapping = {
|
|||
'hdd': 'hdd'
|
||||
}
|
||||
|
||||
class VM(Product):
|
||||
class VM(models.Model):
|
||||
vmid = models.IntegerField(primary_key=True)
|
||||
data = models.JSONField()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
from rest_framework import viewsets, permissions
|
||||
|
||||
from .models import VM
|
||||
from .serializers import OpenNebulaVMSerializer
|
||||
#from .models import VM
|
||||
# from .serializers import OpenNebulaVMSerializer
|
||||
|
||||
class VMViewSet(viewsets.ModelViewSet):
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
serializer_class = 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)
|
||||
# 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
|
||||
# return obj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue