continued work on price model

This commit is contained in:
Tobias Brunner 2025-05-22 16:34:15 +02:00
parent 6f41c8c344
commit a6a15150ea
No known key found for this signature in database
10 changed files with 500 additions and 1 deletions

View file

@ -0,0 +1,87 @@
# Generated by Django 5.2 on 2025-05-22 14:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0023_alter_computeplan_options_and_more"),
]
operations = [
migrations.CreateModel(
name="StoragePlan",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=200)),
("valid_from", models.DateTimeField(blank=True, null=True)),
("valid_to", models.DateTimeField(blank=True, null=True)),
(
"cloud_provider",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="storage_plans",
to="services.cloudprovider",
),
),
],
options={
"ordering": ["name"],
},
),
migrations.CreateModel(
name="StoragePlanPrice",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"currency",
models.CharField(
choices=[
("CHF", "Swiss Franc"),
("EUR", "Euro"),
("USD", "US Dollar"),
],
max_length=3,
),
),
(
"amount",
models.DecimalField(
decimal_places=2,
help_text="Price in the specified currency, excl. VAT",
max_digits=10,
),
),
(
"storage_plan",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="prices",
to="services.storageplan",
),
),
],
options={
"ordering": ["currency"],
"unique_together": {("storage_plan", "currency")},
},
),
]