From d56d7b6bbe127e50a00d0c5ea398875a2f8574e4 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Sun, 2 Sep 2018 14:05:16 +0200 Subject: [PATCH 1/1] fix for multiple agreements --- src/paypal/rest.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/paypal/rest.py b/src/paypal/rest.py index 9d9f45ab9..3590c6f1d 100644 --- a/src/paypal/rest.py +++ b/src/paypal/rest.py @@ -115,11 +115,8 @@ def check_agreement(agreement_id): def user_is_subscribed(user): - try: - agreement = BillingAgreementModel.objects.get(user=user) - except BillingAgreementModel.DoesNotExist: - return False - return agreement.check_agreement() + agreements = BillingAgreementModel.objects.filter(user=user) + return any(agreement.check_agreement() for agreement in agreements) def execute_agreement(token): -- 2.20.1