From: Jan Szejko Date: Sun, 2 Sep 2018 12:05:16 +0000 (+0200) Subject: fix for multiple agreements X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d56d7b6bbe127e50a00d0c5ea398875a2f8574e4?ds=sidebyside;hp=594ca8a0b3632ea7c785c6433b271bafd85bd0d7 fix for multiple agreements --- 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):