compute plan grouping

This commit is contained in:
Tobias Brunner 2025-05-23 17:09:02 +02:00
parent 3896636f9b
commit 19b36b9a2c
No known key found for this signature in database
7 changed files with 284 additions and 93 deletions

View file

@ -5,6 +5,21 @@ from .providers import CloudProvider
from .services import Service
class ComputePlanGroup(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(blank=True)
node_label = models.CharField(
max_length=100, help_text="Kubernetes node label for this group"
)
order = models.IntegerField(default=0)
class Meta:
ordering = ["order", "name"]
def __str__(self):
return self.name
class ComputePlanPrice(models.Model):
compute_plan = models.ForeignKey(
"ComputePlan", on_delete=models.CASCADE, related_name="prices"
@ -45,6 +60,15 @@ class ComputePlan(models.Model):
CloudProvider, on_delete=models.CASCADE, related_name="compute_plans"
)
group = models.ForeignKey(
ComputePlanGroup,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="compute_plans",
help_text="Group this compute plan belongs to",
)
valid_from = models.DateTimeField(blank=True, null=True)
valid_to = models.DateTimeField(blank=True, null=True)