initial work on comparison

This commit is contained in:
Tobias Brunner 2025-05-27 17:07:55 +02:00
parent 06b4cba4bc
commit 4cffe5a9e3
No known key found for this signature in database
6 changed files with 358 additions and 2 deletions

View file

@ -382,3 +382,72 @@ class VSHNAppCatUnitRate(models.Model):
def __str__(self):
return f"{self.vshn_appcat_price_config.service.name} - {self.get_service_level_display()} Unit Rate - {self.amount} {self.currency}"
class ExternalPricePlans(models.Model):
plan_name = models.CharField()
description = models.CharField(max_length=200, blank=True, null=True)
source = models.URLField(blank=True, null=True)
date_retrieved = models.DateField(blank=True, null=True)
## Relations
cloud_provider = models.ForeignKey(
CloudProvider, on_delete=models.CASCADE, related_name="external_price"
)
service = models.ForeignKey(
Service, on_delete=models.CASCADE, related_name="external_price"
)
compare_to = models.ManyToManyField(
ComputePlan, related_name="external_prices", blank=True, null=True
)
vshn_appcat_price = models.ForeignKey(
VSHNAppCatPrice,
on_delete=models.CASCADE,
related_name="external_comparisons",
blank=True,
null=True,
help_text="Specific VSHN AppCat price configuration to compare against",
)
service_level = models.CharField(
max_length=2,
choices=VSHNAppCatPrice.ServiceLevel.choices,
blank=True,
null=True,
help_text="Service level equivalent for comparison",
)
## Money
currency = models.CharField(
max_length=3,
default=Currency.CHF,
choices=Currency.choices,
)
term = models.CharField(
max_length=3,
default=Term.MTH,
choices=Term.choices,
)
amount = models.DecimalField(
max_digits=10,
decimal_places=4,
help_text="Price per unit in the specified currency, excl. VAT",
)
## Offering
vcpus = models.FloatField(
help_text="Number of included vCPUs", blank=True, null=True
)
ram = models.FloatField(
help_text="Amount of GiB RAM included", blank=True, null=True
)
storage = models.FloatField(
help_text="Amount of GiB included", blank=True, null=True
)
competitor_sla = models.CharField(blank=True, null=True)
replicas = models.IntegerField(blank=True, null=True)
class Meta:
verbose_name = "External Price"
def __str__(self):
return f"{self.cloud_provider.name} - {self.service.name} - {self.plan_name}"