Products
This commit is contained in:
parent
70c5345ebd
commit
aef48f4514
@ -139,7 +139,7 @@ class ExercisePlanTranslation(models.Model):
|
||||
|
||||
|
||||
class ExercisePlanDetail(models.Model):
|
||||
exercise_plan_detail_id = models.AutoField(primary_key=True)
|
||||
exercise_plan_detail_id = models.AutoField(primary_key=True)
|
||||
exercise_plan = models.ForeignKey(ExercisePlan, on_delete=models.CASCADE)
|
||||
exercise_type = models.ForeignKey(ExerciseType, on_delete=models.CASCADE)
|
||||
serie = models.IntegerField()
|
||||
@ -150,3 +150,39 @@ class ExercisePlanDetail(models.Model):
|
||||
db_table = 'exercise_plan_detail'
|
||||
verbose_name = _("Exercise Plan Detail")
|
||||
verbose_name_plural = _("Exercise Plan Details")
|
||||
|
||||
|
||||
class ProductTypes(models.TextChoices):
|
||||
SUBS = "subscription"
|
||||
IN_APP_CURR = "in-app-currency"
|
||||
|
||||
|
||||
class Product(models.Model):
|
||||
product_id = models.AutoField(primary_key=True)
|
||||
name = models.CharField(max_length=50)
|
||||
description = models.TextField(max_length=1000, blank=True, null=True)
|
||||
type = models.CharField(max_length=15, choices=ProductTypes.choices, default=ProductTypes.SUBS)
|
||||
valid_from = models.DateField(blank=True, null=True)
|
||||
valid_to = models.DateField(blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'product'
|
||||
verbose_name = _("Product")
|
||||
verbose_name_plural = _("Products")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class CustomerProduct(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
product = models.ForeignKey(Product, on_delete=models.CASCADE)
|
||||
customer_id = models.IntegerField()
|
||||
date_add = models.DateField(blank=True, null=True)
|
||||
purchase_sum = models.DecimalField(decimal_places=2, max_digits=7)
|
||||
currency = models.CharField(max_length=3)
|
||||
|
||||
class Meta:
|
||||
db_table = 'customer_product'
|
||||
verbose_name = _("Purchase")
|
||||
verbose_name_plural = _("Purchases")
|
||||
|
Loading…
Reference in New Issue
Block a user