mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-09 08:14:39 +00:00
update subscription price
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.2.3 on 2025-10-06 11:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import subscription.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("subscription", "0015_alter_subscription_location_and_more")]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="subscription",
|
||||
name="subscription_type",
|
||||
field=models.CharField(
|
||||
choices=subscription.models.get_subscription_types,
|
||||
max_length=255,
|
||||
verbose_name="subscription type",
|
||||
),
|
||||
)
|
||||
]
|
@@ -38,16 +38,19 @@ def validate_payment(value):
|
||||
raise ValidationError(_("Bad payment method"))
|
||||
|
||||
|
||||
def get_subscription_types():
|
||||
return (
|
||||
(k, f"{v['name']}, {v['price']}€")
|
||||
for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
||||
)
|
||||
|
||||
|
||||
class Subscription(models.Model):
|
||||
member = models.ForeignKey(
|
||||
User, related_name="subscriptions", on_delete=models.CASCADE
|
||||
)
|
||||
subscription_type = models.CharField(
|
||||
_("subscription type"),
|
||||
max_length=255,
|
||||
choices=(
|
||||
(k, v["name"]) for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
||||
),
|
||||
_("subscription type"), max_length=255, choices=get_subscription_types
|
||||
)
|
||||
subscription_start = models.DateField(_("subscription start"))
|
||||
subscription_end = models.DateField(_("subscription end"))
|
||||
|
Reference in New Issue
Block a user