correct discount model
This commit is contained in:
parent
f5f4ec8ac9
commit
3896636f9b
6 changed files with 201 additions and 55 deletions
|
@ -0,0 +1,77 @@
|
|||
# Generated by Django 5.2 on 2025-05-23 14:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def delete_all_discount_tiers(apps, schema_editor):
|
||||
DiscountTier = apps.get_model("services", "DiscountTier")
|
||||
DiscountTier.objects.all().delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"services",
|
||||
"0026_progressivediscountmodel_vshnappcatprice_valid_from_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(delete_all_discount_tiers),
|
||||
migrations.AlterModelOptions(
|
||||
name="category",
|
||||
options={
|
||||
"ordering": ["order", "name"],
|
||||
"verbose_name": "Service Category",
|
||||
"verbose_name_plural": "Service Categories",
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="discounttier",
|
||||
options={"ordering": ["min_units"]},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="progressivediscountmodel",
|
||||
options={"verbose_name": "Discount Model"},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="vshnappcatbasefee",
|
||||
options={"ordering": ["currency"], "verbose_name": "Service Base Fee"},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="vshnappcatprice",
|
||||
options={"verbose_name": "AppCat Price"},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="vshnappcatunitrate",
|
||||
options={
|
||||
"ordering": ["currency", "service_level"],
|
||||
"verbose_name": "Service Unit Rate",
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="discounttier",
|
||||
name="min_units",
|
||||
field=models.PositiveIntegerField(
|
||||
default=0, help_text="Minimum unit count for this tier (inclusive)"
|
||||
),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="discounttier",
|
||||
unique_together={("discount_model", "min_units")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="discounttier",
|
||||
name="max_units",
|
||||
field=models.PositiveIntegerField(
|
||||
blank=True,
|
||||
help_text="Maximum unit count for this tier (exclusive). Leave blank for unlimited.",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="discounttier",
|
||||
name="threshold",
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue