From d14a6431712c2ffb4f2e99084fc05017a48c586e Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 28 Oct 2017 15:26:15 +0200 Subject: [PATCH] Set preferred field as in card_details --- hosting/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hosting/models.py b/hosting/models.py index ae047628..d95adf13 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -254,6 +254,9 @@ class UserCardDetail(AssignPermissionsMixin, models.Model): exp_year=card_details['exp_year'] ) except UserCardDetail.DoesNotExist: + preferred = False + if 'preferred' in card_details: + preferred = card_details['preferred'] card_detail = UserCardDetail.create( stripe_customer=stripe_customer, last4=card_details['last4'], @@ -261,7 +264,8 @@ class UserCardDetail(AssignPermissionsMixin, models.Model): fingerprint=card_details['fingerprint'], exp_month=card_details['exp_month'], exp_year=card_details['exp_year'], - card_id=card_details['card_id'] + card_id=card_details['card_id'], + preferred=preferred ) return card_detail