aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/payments/signals.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-14 15:54:21 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-14 15:54:21 +0100
commitf312ec6d4a577e71d76cf85632a198b0c1913703 (patch)
treeeccd268d4432c32b9fee6665e0bbba87967b6fef /pyblackbird_cc/payments/signals.py
parentd2abe12612108b94135dcb0701614dc216fb92d2 (diff)
wip: adding shopping card functionality
Diffstat (limited to '')
-rw-r--r--pyblackbird_cc/payments/signals.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pyblackbird_cc/payments/signals.py b/pyblackbird_cc/payments/signals.py
index e660440..24fc1d8 100644
--- a/pyblackbird_cc/payments/signals.py
+++ b/pyblackbird_cc/payments/signals.py
@@ -5,7 +5,7 @@ from django.db import transaction
from django.dispatch import receiver
from django.utils import timezone
-from .models import Subscription
+from .models import ShoppingCart, Subscription
from .models import SubscriptionPlan
@@ -30,3 +30,10 @@ def assign_default_subscription(sender, request, user, **kwargs):
start_date=timezone.now(),
end_date=timezone.now() + timedelta(days=365), # Example: 30 days
)
+
+
+@receiver(user_signed_up)
+def assign_user_a_shopping_cart(sender, request, user, **kwargs):
+ with transaction.atomic():
+ # Create a ShoppingCart for the new user
+ ShoppingCart.objects.create(user=user)