aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/payments/signals.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-15 21:01:31 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-15 21:01:31 +0100
commiteeaddb27560d723ca7d61359744ceb2709fccd2d (patch)
tree04ddbc49ae7b73d5f5a9e1716d7227aecd3b9f85 /pyblackbird_cc/payments/signals.py
parent7a3044c859043837e6c7c95bb4894d04e9b2cbc2 (diff)
Renamed from pyblackbird_cc to alphabetlearning - everywhere
Diffstat (limited to 'pyblackbird_cc/payments/signals.py')
-rw-r--r--pyblackbird_cc/payments/signals.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/pyblackbird_cc/payments/signals.py b/pyblackbird_cc/payments/signals.py
deleted file mode 100644
index 50d988b..0000000
--- a/pyblackbird_cc/payments/signals.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from datetime import timedelta
-
-from allauth.account.signals import user_signed_up
-from django.db import transaction
-from django.dispatch import receiver
-from django.utils import timezone
-
-from .models import ShoppingCart
-from .models import Subscription
-from .models import SubscriptionPlan
-
-
-@receiver(user_signed_up)
-def assign_default_subscription(sender, request, user, **kwargs):
- with transaction.atomic():
- # Get or create the free plan subscription
- free_plan, _ = SubscriptionPlan.objects.get_or_create(
- name="Free Plan",
- defaults={
- "price": 0,
- "description": "Free plan description",
- "allowed_downloads": 10,
- },
- )
-
- # Create a SubscriptionPlan for the new user
- Subscription.objects.create(
- user=user,
- plan=free_plan,
- is_active=True,
- 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)