Begin implementing Drilldown plan

This commit is contained in:
2022-07-21 13:45:57 +01:00
parent 85998bbc38
commit 4bd2bb2f1a
7 changed files with 78 additions and 146 deletions

View File

@@ -4,12 +4,12 @@ from django.db import models
# Create your models here.
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.CharField(max_length=1024)
class Plan(models.Model):
name = models.CharField(max_length=255, unique=True)
description = models.CharField(max_length=1024, null=True, blank=True)
cost = models.IntegerField()
product_id = models.UUIDField(blank=True)
image = models.CharField(max_length=1024, blank=True)
product_id = models.UUIDField(null=True, blank=True)
image = models.CharField(max_length=1024, null=True, blank=True)
def __str__(self):
return f"{self.name}{self.cost})"
@@ -17,12 +17,12 @@ class Product(models.Model):
class User(AbstractUser):
# Stripe customer ID
stripe_id = models.CharField(max_length=255, blank=True)
subscription_id = models.CharField(max_length=255, blank=True)
subscription_active = models.BooleanField(blank=True)
last_payment = models.DateTimeField(blank=True)
paid = models.BooleanField(blank=True)
plans = models.ManyToManyField(Product, blank=True)
stripe_id = models.CharField(max_length=255, null=True, blank=True)
subscription_id = models.CharField(max_length=255, null=True, blank=True)
subscription_active = models.BooleanField(null=True, blank=True)
last_payment = models.DateTimeField(null=True, blank=True)
paid = models.BooleanField(null=True, blank=True)
plans = models.ManyToManyField(Plan, blank=True)
def has_plan(self, plan):
plan_list = [plan.name for plan in self.plans.all()]