Format cc month to 2 decimal places
This commit is contained in:
parent
fe44908868
commit
903ef48c75
3 changed files with 4 additions and 4 deletions
|
@ -569,14 +569,14 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
context['cc_last4'] = card_details_response['last4']
|
context['cc_last4'] = card_details_response['last4']
|
||||||
context['cc_brand'] = card_details_response['brand']
|
context['cc_brand'] = card_details_response['brand']
|
||||||
context['cc_exp_year'] = card_details_response['exp_year']
|
context['cc_exp_year'] = card_details_response['exp_year']
|
||||||
context['cc_exp_month'] = card_details_response['exp_month']
|
context['cc_exp_month'] = '{:02d}'.format(card_details_response['exp_month'])
|
||||||
else:
|
else:
|
||||||
card_id = self.request.session.get('card_id')
|
card_id = self.request.session.get('card_id')
|
||||||
card_detail = UserCardDetail.objects.get(id=card_id)
|
card_detail = UserCardDetail.objects.get(id=card_id)
|
||||||
context['cc_last4'] = card_detail.last4
|
context['cc_last4'] = card_detail.last4
|
||||||
context['cc_brand'] = card_detail.brand
|
context['cc_brand'] = card_detail.brand
|
||||||
context['cc_exp_year'] = card_detail.exp_year
|
context['cc_exp_year'] = card_detail.exp_year
|
||||||
context['cc_exp_month'] = card_detail.exp_month
|
context['cc_exp_month'] ='{:02d}'.format(card_detail.exp_month)
|
||||||
|
|
||||||
if ('generic_payment_type' in request.session and
|
if ('generic_payment_type' in request.session and
|
||||||
self.request.session['generic_payment_type'] == 'generic'):
|
self.request.session['generic_payment_type'] == 'generic'):
|
||||||
|
|
|
@ -598,7 +598,7 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
|
||||||
cards_list.append({
|
cards_list.append({
|
||||||
'last4': card.last4, 'brand': card.brand, 'id': card.id,
|
'last4': card.last4, 'brand': card.brand, 'id': card.id,
|
||||||
'exp_year': card.exp_year,
|
'exp_year': card.exp_year,
|
||||||
'exp_month': card.exp_month,
|
'exp_month': '{:02d}'.format(card.exp_month),
|
||||||
'preferred': card.preferred
|
'preferred': card.preferred
|
||||||
})
|
})
|
||||||
return cards_list
|
return cards_list
|
||||||
|
|
|
@ -914,7 +914,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
|
||||||
context['cc_last4'] = card_detail.last4
|
context['cc_last4'] = card_detail.last4
|
||||||
context['cc_brand'] = card_detail.brand
|
context['cc_brand'] = card_detail.brand
|
||||||
context['cc_exp_year'] = card_detail.exp_year
|
context['cc_exp_year'] = card_detail.exp_year
|
||||||
context['cc_exp_month'] = card_detail.exp_month
|
context['cc_exp_month'] = '{:02d}'.format(card_detail.exp_month)
|
||||||
context['site_url'] = reverse('hosting:create_virtual_machine')
|
context['site_url'] = reverse('hosting:create_virtual_machine')
|
||||||
context['vm'] = self.request.session.get('specs')
|
context['vm'] = self.request.session.get('specs')
|
||||||
return context
|
return context
|
||||||
|
|
Loading…
Reference in a new issue