{% load url from future %}

<div class="cancel-subscription">
    <h2>Cancel Subscription</h2>
    <p class="lead">Are you sure that you want to cancel?</p>
    
    {% if request.user.customer.current_subscription.status == 'canceled' %}
        <div class="alert alert-danger">You account has been canceled. It will remain active until <strong>{{ request.user.customer.current_subscription.current_period_end }}.</strong>
    {% else %}
    {% if error %}
        <div class="alert alert-error">{{ error }}</div>
    {% endif %}
    <form class="form ajax" data-replace-closest=".cancel-subscription" action="{% url 'payments_ajax_cancel' %}" method="POST">
        {% csrf_token %}
        <div class="actions">
            <button type="submit" class="btn btn-mini btn-danger">Cancel</button>
        </div>
    </form>
    {% endif %}
</div>