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) null=True)
description = "Virtual Machine" 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() cores = models.IntegerField()
ram_in_gb = models.FloatField() ram_in_gb = models.FloatField()

View file

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