From e2f7479657f0c680079205fcd8d32db770b9dbb1 Mon Sep 17 00:00:00 2001 From: shankline Date: Thu, 22 Oct 2020 08:11:18 +0300 Subject: [PATCH 1/2] first commit --- accounts/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/accounts/models.py b/accounts/models.py index ba39823..ee9221b 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -27,6 +27,7 @@ class CustomUser(AbstractBaseUser): USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['name', 'phone'] + def has_perm(self, perm, obj=None): return True From 3fb5331e7214c5dc2dfa6ece2065d723b58a9181 Mon Sep 17 00:00:00 2001 From: shankline Date: Thu, 22 Oct 2020 16:10:27 +0300 Subject: [PATCH 2/2] creating subscription on sign up --- accounts/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 35ffeb4..165170d 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -61,6 +61,9 @@ def signup(request): business = Business(user=user) business.save() + # Create Plan + plan = Plan(name="testplan", description="test_description",duration_days=10,price=500.00,max_staff=10,max_branch=4) + plan.save() # create BusinessTeamMember business_team = BusinessTeamMember.objects.get_or_create( business=business, user=user) @@ -69,13 +72,14 @@ def signup(request): ends_time = timezone.now() + timedelta(days=14) subscription = Subscription.objects.get_or_create( - plan_id=1, + plan=plan, business=business, start_time=timezone.now(), ends_time=ends_time, is_active=True, ) - + # import pdb + # pdb.set_trace() # send confirmation email token = account_activation_token.make_token(user) user_id = urlsafe_base64_encode(force_bytes(user.id))