forked from GithubBackups/healthchecks
Fix active plan display in the pricing page.
This commit is contained in:
parent
39bc12e351
commit
1497ff204b
@ -35,3 +35,14 @@ class PricingTestCase(BaseTestCase):
|
||||
|
||||
r = self.client.get("/pricing/")
|
||||
self.assertContains(r, "To manage this team")
|
||||
|
||||
def test_it_shows_active_plan(self):
|
||||
self.sub = Subscription(user=self.alice)
|
||||
self.sub.subscription_id = "test-id"
|
||||
self.sub.plan_id = "P5"
|
||||
self.sub.save()
|
||||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
|
||||
r = self.client.get("/pricing/")
|
||||
self.assertContains(r, "Standard (monthly)", status_code=200)
|
||||
|
@ -3,7 +3,6 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.http import (HttpResponseBadRequest, HttpResponseForbidden,
|
||||
JsonResponse, HttpResponse)
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.decorators.http import require_POST
|
||||
import six
|
||||
@ -24,7 +23,11 @@ def pricing(request):
|
||||
ctx = {"page": "pricing"}
|
||||
return render(request, "payments/pricing_not_owner.html", ctx)
|
||||
|
||||
ctx = {"page": "pricing"}
|
||||
# Don't use Subscription.objects.for_user method here, so a
|
||||
# subscription object is not created just by viewing a page.
|
||||
sub = Subscription.objects.filter(user_id=request.user.id).first()
|
||||
|
||||
ctx = {"page": "pricing", "sub": sub}
|
||||
return render(request, "payments/pricing.html", ctx)
|
||||
|
||||
|
||||
|
@ -238,7 +238,7 @@
|
||||
value="Y48"
|
||||
{% if sub.plan_id == "Y48" %} checked {% endif %}>
|
||||
<span class="radiomark"></span>
|
||||
Yearly, $48/year (20% off monthly)
|
||||
Annual, $48/year (20% off monthly)
|
||||
</label>
|
||||
|
||||
<h2>Plus <small>Unlimited checks, unlimited team members</small></h2>
|
||||
@ -259,7 +259,7 @@
|
||||
value="Y480"
|
||||
{% if sub.plan_id == "Y480" %} checked {% endif %}>
|
||||
<span class="radiomark"></span>
|
||||
Yearly, $480/year (20% off monthly)
|
||||
Annual, $480/year (20% off monthly)
|
||||
</label>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
|
@ -15,13 +15,13 @@
|
||||
<p>
|
||||
Your account is currently on the
|
||||
{% if sub.plan_id == "P5" %}
|
||||
<strong>Monthly Standard</strong>
|
||||
<strong>Standard (monthly)</strong>
|
||||
{% elif sub.plan_id == "P50" %}
|
||||
<strong>Monthly Plus</strong>
|
||||
<strong>Plus (monthly)</strong>
|
||||
{% elif sub.plan_id == "Y48" %}
|
||||
<strong>Yearly Standard</strong>
|
||||
<strong>Standard (annual)</strong>
|
||||
{% elif sub.plan_id == "Y480" %}
|
||||
<strong>Yearly Plus</strong>
|
||||
<strong>Plus (annual)</strong>
|
||||
{% else %}
|
||||
<strong>Free</strong>
|
||||
{% endif %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user