forked from uncloud/uncloud
288a65f219
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
30 lines
752 B
Python
30 lines
752 B
Python
from django.contrib.auth import get_user_model
|
|
|
|
from rest_framework import serializers
|
|
from .models import VMHost, VMProduct, VMSnapshotProduct
|
|
|
|
class VMHostSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = VMHost
|
|
fields = '__all__'
|
|
|
|
|
|
class VMProductSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = VMProduct
|
|
fields = '__all__'
|
|
|
|
|
|
# def create(self, validated_data):
|
|
# return VMSnapshotProduct()
|
|
|
|
class VMSnapshotProductSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = VMSnapshotProduct
|
|
fields = '__all__'
|
|
|
|
|
|
# verify that vm.owner == user.request
|
|
def validate_vm(self, value):
|
|
print(value)
|
|
return True
|