aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-19 19:43:59 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-19 19:43:59 +0100
commit1e1a2f6ac2cadfbc57cc855a67498af097391caf (patch)
tree8e28486d182d6b4746d4feb22347badf21f5465d /alphabetlearning/payments/models.py
parentae9bc97c743ea4d31a3f392db72a948d87d3b2ab (diff)
Changes the Resource to include Stripe reference
Diffstat (limited to 'alphabetlearning/payments/models.py')
-rw-r--r--alphabetlearning/payments/models.py5
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)