Fix error accessing stripecustomer for user when it doesn't exist

This commit is contained in:
PCoder 2017-10-30 08:26:35 +01:00
parent 24d904288f
commit a2a35a9475

View file

@ -552,8 +552,11 @@ class SettingsView(LoginRequiredMixin, FormView):
def get_context_data(self, **kwargs):
context = super(SettingsView, self).get_context_data(**kwargs)
user = self.request.user
stripe_customer = None
if hasattr(user, 'stripecustomer'):
stripe_customer = user.stripecustomer
cards_list = UserCardDetail.get_all_cards_list(
stripe_customer=user.stripecustomer
stripe_customer=stripe_customer
)
context.update({
'cards_list': cards_list,