Set user.paid_lifetime if paid coupon
This commit is contained in:
parent
050c2feaeb
commit
4f7b30c204
|
@ -33,11 +33,12 @@ def lifetime_licence():
|
||||||
if coupon_form.validate_on_submit():
|
if coupon_form.validate_on_submit():
|
||||||
code = coupon_form.code.data
|
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:
|
if coupon and coupon.nb_used > 0:
|
||||||
coupon.nb_used -= 1
|
coupon.nb_used -= 1
|
||||||
current_user.lifetime = True
|
current_user.lifetime = True
|
||||||
|
if coupon.paid:
|
||||||
|
current_user.paid_lifetime = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
# notify admin
|
# notify admin
|
||||||
|
|
Loading…
Reference in New Issue