Cleanup VMProduct serializer, add name field to VMProduct

This commit is contained in:
fnux 2020-02-28 15:07:20 +01:00
parent b3bbfafa04
commit 181005ad6c
2 changed files with 7 additions and 5 deletions

View File

@ -41,6 +41,10 @@ class VMProduct(Product):
null=True)
description = "Virtual Machine"
# VM-specific. The name is only intended for customers: it's a pain te
# remember IDs (speaking from experience as ungleich customer)!
name = models.CharField(max_length=32)
cores = models.IntegerField()
ram_in_gb = models.FloatField()

View File

@ -12,11 +12,9 @@ class VMHostSerializer(serializers.HyperlinkedModelSerializer):
class VMProductSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = VMProduct
fields = '__all__'
# def create(self, validated_data):
# return VMSnapshotProduct()
fields = ['uuid', 'description', 'order', 'owner', 'status', 'name', \
'cores', 'ram_in_gb']
read_only_fields = ['uuid', 'description', 'order', 'owner', 'status']
class VMSnapshotProductSerializer(serializers.ModelSerializer):
class Meta: