Beispiel #1
0
 def get_context_data(self, **kwargs):
     context = super(PurchaseView, self).get_context_data(**kwargs)
     prepaid_reservation = PrePaidReservation.objects.get(
         pk=self.kwargs['id'])
     context['user_affords_reservation'] = balance(
         self.request) >= prepaid_reservation.upfront_price
     context['reservation_id'] = self.kwargs['id']
     context['price'] = prepaid_reservation.formatted_upfront_price
     return context
Beispiel #2
0
 def get_context_data(self, **kwargs):
     context = super(PurchaseView, self).get_context_data(**kwargs)
     prepaid_reservation = PrePaidReservation.objects.get(
         pk=self.kwargs['id'])
     context['user_affords_reservation'] = balance(
         self.request) >= prepaid_reservation.upfront_price
     context['reservation_id'] = self.kwargs['id']
     context['price'] = prepaid_reservation.formatted_upfront_price
     return context
Beispiel #3
0
def balance(request):
    if request.user.is_authenticated():
        return {'balance': utils.balance(request)}
    return {}