From 1a9f7e17f8d7c7d03587d2939dc789874d76133e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Fri, 14 Dec 2018 11:05:57 +0200 Subject: [PATCH] Cancelling a plan clears out Subscription.plan_name --- hc/payments/models.py | 1 + hc/payments/tests/test_set_plan.py | 2 ++ templates/accounts/billing.html | 8 +------- templates/payments/pricing.html | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hc/payments/models.py b/hc/payments/models.py index c1aa668d..e7f068ce 100644 --- a/hc/payments/models.py +++ b/hc/payments/models.py @@ -167,6 +167,7 @@ class Subscription(models.Model): self.subscription_id = "" self.plan_id = "" + self.plan_name = "" self.save() def pm_is_card(self): diff --git a/hc/payments/tests/test_set_plan.py b/hc/payments/tests/test_set_plan.py index 9044609d..c9529ede 100644 --- a/hc/payments/tests/test_set_plan.py +++ b/hc/payments/tests/test_set_plan.py @@ -108,6 +108,7 @@ class SetPlanTestCase(BaseTestCase): self.sub = Subscription(user=self.alice) self.sub.subscription_id = "test-id" self.sub.plan_id = "P20" + self.sub.plan_name = "Business ($20/mo)" self.sub.save() self.profile.sms_limit = 1 @@ -121,6 +122,7 @@ class SetPlanTestCase(BaseTestCase): sub = Subscription.objects.get(user=self.alice) self.assertEqual(sub.subscription_id, "") self.assertEqual(sub.plan_id, "") + self.assertEqual(sub.plan_name, "") # User's profile should have standard limits self.profile.refresh_from_db() diff --git a/templates/accounts/billing.html b/templates/accounts/billing.html index 83da3d0e..fa026f72 100644 --- a/templates/accounts/billing.html +++ b/templates/accounts/billing.html @@ -42,13 +42,7 @@ - + {% if sub.plan_id %} diff --git a/templates/payments/pricing.html b/templates/payments/pricing.html index a7550624..586b0d3c 100644 --- a/templates/payments/pricing.html +++ b/templates/payments/pricing.html @@ -27,7 +27,7 @@ plan. Thank you for supporting {% site_name %}! {% else %} Your account is currently on the - Hobbyist plan. + {{ sub.plan_name|default:"Hobbyist" }} plan. {% endif %}

Current Plan - {% if sub is None or sub.plan_id == "" %} - Free - {% else %} - {{ sub.plan_name }} - {% endif %} - {{ sub.plan_name|default:"Hobbyist" }}