From 4f7b30c204e86f3619ec2347f540304ac49b8551 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Wed, 21 Oct 2020 19:31:25 +0200 Subject: [PATCH] Set user.paid_lifetime if paid coupon --- app/dashboard/views/lifetime_licence.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/dashboard/views/lifetime_licence.py b/app/dashboard/views/lifetime_licence.py index 92f4790a..f1cdc865 100644 --- a/app/dashboard/views/lifetime_licence.py +++ b/app/dashboard/views/lifetime_licence.py @@ -33,11 +33,12 @@ def lifetime_licence(): if coupon_form.validate_on_submit(): code = coupon_form.code.data - coupon = LifetimeCoupon.get_by(code=code) - + coupon: LifetimeCoupon = LifetimeCoupon.get_by(code=code) if coupon and coupon.nb_used > 0: coupon.nb_used -= 1 current_user.lifetime = True + if coupon.paid: + current_user.paid_lifetime = True db.session.commit() # notify admin