continued work on price model
This commit is contained in:
parent
6f41c8c344
commit
a6a15150ea
10 changed files with 500 additions and 1 deletions
87
hub/services/migrations/0024_storageplan_storageplanprice.py
Normal file
87
hub/services/migrations/0024_storageplan_storageplanprice.py
Normal 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")},
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,70 @@
|
|||
# Generated by Django 5.2 on 2025-05-22 14:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("services", "0024_storageplan_storageplanprice"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="computeplan",
|
||||
name="term",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("MTH", "per Month (30d)"),
|
||||
("DAY", "per Day"),
|
||||
("HR", "per Hour"),
|
||||
("MIN", "per Minute"),
|
||||
],
|
||||
default="MTH",
|
||||
max_length=3,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="storageplan",
|
||||
name="term",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("MTH", "per Month (30d)"),
|
||||
("DAY", "per Day"),
|
||||
("HR", "per Hour"),
|
||||
("MIN", "per Minute"),
|
||||
],
|
||||
default="MTH",
|
||||
max_length=3,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="storageplan",
|
||||
name="unit",
|
||||
field=models.CharField(
|
||||
choices=[("GIB", "GiB"), ("MIB", "MiB"), ("CPU", "vCPU")],
|
||||
default="GIB",
|
||||
max_length=3,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="vshnappcatprice",
|
||||
name="term",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("MTH", "per Month (30d)"),
|
||||
("DAY", "per Day"),
|
||||
("HR", "per Hour"),
|
||||
("MIN", "per Minute"),
|
||||
],
|
||||
default="MTH",
|
||||
max_length=3,
|
||||
),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="storageplan",
|
||||
unique_together={
|
||||
("cloud_provider", "term", "unit", "valid_from", "valid_to")
|
||||
},
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue