diff options
Diffstat (limited to 'alphabetlearning/payments/models.py')
-rw-r--r-- | alphabetlearning/payments/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/alphabetlearning/payments/models.py b/alphabetlearning/payments/models.py index 62bcbde..0ad07fb 100644 --- a/alphabetlearning/payments/models.py +++ b/alphabetlearning/payments/models.py @@ -14,13 +14,16 @@ class Product(models.Model): class Price(models.Model): - product = models.ForeignKey(Product, on_delete=models.CASCADE) + resource = models.ForeignKey(Resource, on_delete=models.CASCADE, related_name="price") price = models.IntegerField(default=0) stripe_price_id = models.CharField(max_length=100) def get_display_price(self): return "{0:.2f}".format(self.price / 100) + def __str__(self): + return f"{self.price} for {self.resource.name}" + class ShoppingCart(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) |