84 lines
2.2 KiB
Python
84 lines
2.2 KiB
Python
from plans.models import Plan, Quota
|
|
from decimal import Decimal
|
|
|
|
|
|
def run():
|
|
# Create quotas first
|
|
free_quota = Quota.objects.create(
|
|
codename="free_quota",
|
|
name="Free Features",
|
|
description="Free plan features",
|
|
is_boolean=True,
|
|
url="pricing",
|
|
)
|
|
basic_quota = Quota.objects.create(
|
|
codename="basic_quota",
|
|
name="Basic Features",
|
|
description="Basic plan features",
|
|
is_boolean=True,
|
|
url="pricing",
|
|
)
|
|
|
|
pro_quota = Quota.objects.create(
|
|
codename="pro_quota",
|
|
name="Pro Features",
|
|
description="Pro plan features",
|
|
is_boolean=True,
|
|
url="pricing",
|
|
)
|
|
|
|
premium_quota = Quota.objects.create(
|
|
codename="premium_quota",
|
|
name="Premium Features",
|
|
description="Premium plan features",
|
|
is_boolean=True,
|
|
url="pricing",
|
|
)
|
|
# Create the plans
|
|
free_plan = Plan.objects.create(
|
|
name="Free",
|
|
description="Free plan with limited features",
|
|
price=Decimal("0.00"), # 0
|
|
period=7, # 1 week
|
|
default=True,
|
|
available=True,
|
|
visible=True,
|
|
order=1,
|
|
)
|
|
free_plan.quotas.add(free_quota)
|
|
|
|
# Create the plans
|
|
basic_plan = Plan.objects.create(
|
|
name="Basic",
|
|
description="Basic plan with limited features",
|
|
price=Decimal("49.00"), # 49 SAR
|
|
period=30, # 30 days
|
|
default=True,
|
|
available=True,
|
|
visible=True,
|
|
order=1,
|
|
)
|
|
basic_plan.quotas.add(basic_quota, free_quota)
|
|
|
|
pro_plan = Plan.objects.create(
|
|
name="Professional",
|
|
description="Professional plan with advanced features",
|
|
price=Decimal("149.00"), # 149 SAR
|
|
# period=30,
|
|
available=True,
|
|
visible=True,
|
|
# order=2
|
|
)
|
|
pro_plan.quotas.add(free_quota, basic_quota, pro_quota)
|
|
|
|
premium_plan = Plan.objects.create(
|
|
name="Premium",
|
|
description="Premium plan with all features",
|
|
price=Decimal("299.00"), # 299 SAR
|
|
period=30,
|
|
available=True,
|
|
visible=True,
|
|
order=3,
|
|
)
|
|
premium_plan.quotas.add(free_quota, basic_quota, pro_quota, premium_quota)
|