Cancelling a plan clears out Subscription.plan_name

This commit is contained in:
Pēteris Caune 2018-12-14 11:05:57 +02:00
parent a8c102f799
commit 1a9f7e17f8
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
4 changed files with 5 additions and 8 deletions

View File

@ -167,6 +167,7 @@ class Subscription(models.Model):
self.subscription_id = "" self.subscription_id = ""
self.plan_id = "" self.plan_id = ""
self.plan_name = ""
self.save() self.save()
def pm_is_card(self): def pm_is_card(self):

View File

@ -108,6 +108,7 @@ class SetPlanTestCase(BaseTestCase):
self.sub = Subscription(user=self.alice) self.sub = Subscription(user=self.alice)
self.sub.subscription_id = "test-id" self.sub.subscription_id = "test-id"
self.sub.plan_id = "P20" self.sub.plan_id = "P20"
self.sub.plan_name = "Business ($20/mo)"
self.sub.save() self.sub.save()
self.profile.sms_limit = 1 self.profile.sms_limit = 1
@ -121,6 +122,7 @@ class SetPlanTestCase(BaseTestCase):
sub = Subscription.objects.get(user=self.alice) sub = Subscription.objects.get(user=self.alice)
self.assertEqual(sub.subscription_id, "") self.assertEqual(sub.subscription_id, "")
self.assertEqual(sub.plan_id, "") self.assertEqual(sub.plan_id, "")
self.assertEqual(sub.plan_name, "")
# User's profile should have standard limits # User's profile should have standard limits
self.profile.refresh_from_db() self.profile.refresh_from_db()

View File

@ -42,13 +42,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td>Current Plan</td> <td>Current Plan</td>
<td> <td>{{ sub.plan_name|default:"Hobbyist" }}</td>
{% if sub is None or sub.plan_id == "" %}
Free
{% else %}
{{ sub.plan_name }}
{% endif %}
</td>
</tr> </tr>
{% if sub.plan_id %} {% if sub.plan_id %}
<tr> <tr>

View File

@ -27,7 +27,7 @@
plan. Thank you for supporting {% site_name %}! plan. Thank you for supporting {% site_name %}!
{% else %} {% else %}
Your account is currently on the Your account is currently on the
<strong>Hobbyist</strong> plan. <strong>{{ sub.plan_name|default:"Hobbyist" }}</strong> plan.
{% endif %} {% endif %}
</p> </p>
<p> <p>