Format cc month to 2 decimal places

This commit is contained in:
PCoder 2019-07-09 19:03:09 +05:30
parent fe44908868
commit 903ef48c75
3 changed files with 4 additions and 4 deletions

View file

@ -569,14 +569,14 @@ class OrderConfirmationView(DetailView, FormView):
context['cc_last4'] = card_details_response['last4']
context['cc_brand'] = card_details_response['brand']
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:
card_id = self.request.session.get('card_id')
card_detail = UserCardDetail.objects.get(id=card_id)
context['cc_last4'] = card_detail.last4
context['cc_brand'] = card_detail.brand
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
self.request.session['generic_payment_type'] == 'generic'):

View file

@ -598,7 +598,7 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
cards_list.append({
'last4': card.last4, 'brand': card.brand, 'id': card.id,
'exp_year': card.exp_year,
'exp_month': card.exp_month,
'exp_month': '{:02d}'.format(card.exp_month),
'preferred': card.preferred
})
return cards_list

View file

@ -914,7 +914,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
context['cc_last4'] = card_detail.last4
context['cc_brand'] = card_detail.brand
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['vm'] = self.request.session.get('specs')
return context