Make ProductPaymentForm's recurring field hidden
This commit is contained in:
parent
ec70cd1c83
commit
b3e3af1c1a
2 changed files with 17 additions and 1 deletions
|
@ -109,6 +109,17 @@ class ProductPaymentForm(GenericPaymentForm):
|
||||||
'readonly': 'readonly' }
|
'readonly': 'readonly' }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if self.product.product_is_subscription:
|
||||||
|
self.fields['amount'].label = "{amt} ({payment_type})".format(
|
||||||
|
amt=_('Amount in CHF'),
|
||||||
|
payment_type=_('Monthly subscription')
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.fields['amount'].label = "{amt} ({payment_type})".format(
|
||||||
|
amt=_('Amount in CHF'),
|
||||||
|
payment_type = _('One time payment')
|
||||||
|
)
|
||||||
|
self.fields['recurring'].widget=forms.HiddenInput()
|
||||||
|
|
||||||
def clean_amount(self):
|
def clean_amount(self):
|
||||||
amount = self.cleaned_data.get('amount')
|
amount = self.cleaned_data.get('amount')
|
||||||
|
|
|
@ -165,9 +165,14 @@ $(document).ready(function () {
|
||||||
|
|
||||||
function submitBillingForm() {
|
function submitBillingForm() {
|
||||||
var billing_form = $('#billing-form');
|
var billing_form = $('#billing-form');
|
||||||
|
var recurring_input = $('#id_generic_payment_form-recurring');
|
||||||
billing_form.append('<input type="hidden" name="generic_payment_form-product_name" value="' + $('#id_generic_payment_form-product_name').val() + '" />');
|
billing_form.append('<input type="hidden" name="generic_payment_form-product_name" value="' + $('#id_generic_payment_form-product_name').val() + '" />');
|
||||||
billing_form.append('<input type="hidden" name="generic_payment_form-amount" value="' + $('#id_generic_payment_form-amount').val() + '" />');
|
billing_form.append('<input type="hidden" name="generic_payment_form-amount" value="' + $('#id_generic_payment_form-amount').val() + '" />');
|
||||||
billing_form.append('<input type="hidden" name="generic_payment_form-recurring" value="' + ($('#id_generic_payment_form-recurring').prop('checked') ? 'on' : '') + '" />');
|
if (recurring_input.attr('type') === 'hidden') {
|
||||||
|
billing_form.append('<input type="hidden" name="generic_payment_form-recurring" value="' + (recurring_input.val() === 'True' ? 'on' : '') + '" />');
|
||||||
|
} else {
|
||||||
|
billing_form.append('<input type="hidden" name="generic_payment_form-recurring" value="' + (recurring_input.prop('checked') ? 'on' : '') + '" />');
|
||||||
|
}
|
||||||
billing_form.append('<input type="hidden" name="generic_payment_form-description" value="' + $('#id_generic_payment_form-description').val() + '" />');
|
billing_form.append('<input type="hidden" name="generic_payment_form-description" value="' + $('#id_generic_payment_form-description').val() + '" />');
|
||||||
billing_form.submit();
|
billing_form.submit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue