Files
@ 52127f437376
Branch filter:
Location: C3L/C3L-Membership-Online-Form/c3l_membership/views.py - annotation
52127f437376
1.3 KiB
text/x-python
Split up membership plans into more fields.
Student and starving are now options that can be selected additionally to the
regular or supporting membership.
Student and starving are now options that can be selected additionally to the
regular or supporting membership.
6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 52127f437376 52127f437376 52127f437376 52127f437376 52127f437376 52127f437376 52127f437376 52127f437376 6f06fc328a13 52127f437376 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 6f06fc328a13 52127f437376 6f06fc328a13 6f06fc328a13 | import subprocess
from datetime import date
from flask import Blueprint, current_app, render_template, request
from flask_weasyprint import HTML, render_pdf
from .forms import MembershipForm
root_page = Blueprint("root", __name__)
@root_page.route("/", methods=("GET", "POST"))
def index():
form = MembershipForm()
if form.validate_on_submit():
if (
form.minor_member.data
or form.student.data
or form.membership.data == "supporting"
):
price = 40
elif form.membership.data == "regular":
price = 120
if form.starving.data:
price = 1
if form.payment.data == "bitcoin":
price = subprocess.check_output(
["/usr/local/share/btc/BTC_Membership.pl", str(price)]
).decode("utf-8")
elif form.payment.data == "ethereum":
price = subprocess.check_output(
["/usr/local/share/eth/ETH_Membership.pl", str(price)]
).decode("utf-8")
elif form.payment.data == "digicash":
price = price * 100
year = date.today().year
html = render_template("member.html", form=form, price=price, year=year)
return render_pdf(HTML(string=html))
return render_template("index.html", form=form)
|