Changeset - 81d8f0641a9c
[Not reviewed]
default
0 1 0
Dennis Fink - 3 years ago 2022-01-19 20:56:06
dennis.fink@c3l.lu
Reformat stuff
1 file changed with 26 insertions and 25 deletions:
0 comments (0 inline, 0 general)
c3l_membership/views.py
Show inline comments
 
@@ -51,8 +51,6 @@ def index():
 

	
 
    if form.validate_on_submit():
 

	
 
        xml_data = {}
 

	
 
        if (
 
            form.minor_member.data
 
            or form.student.data
 
@@ -73,25 +71,6 @@ def index():
 
        else:
 
            status = "Regular"
 

	
 
        xml_data["status"] = status
 
        xml_data["name"] = form.fullname.data
 
        xml_data["birthday"] = (
 
            form.birthday.data if form.birthday.data is not None else date(9999, 12, 12)
 
        )
 
        xml_data["username"] = form.username.data
 
        xml_data["email"] = form.email.data
 
        xml_data["address"] = " ".join(
 
            (
 
                form.street.data,
 
                form.zip.data,
 
                form.city.data,
 
                form.state.data,
 
                form.country.data,
 
            )
 
        )
 
        xml_data["address"] = re.sub("\s+", " ", xml_data["address"])
 
        xml_data["voting"] = 1 if form.membership.data == "regular" else 0
 

	
 
        if form.payment.data in current_app.config["CRYPTOCURRENCIES"]:
 
            try:
 
                current_conversion_r = requests.get(
 
@@ -110,12 +89,34 @@ def index():
 
            price = price * 100
 

	
 
        now = date.today()
 
        year = now.year
 
        xml_data["date"] = now
 
        xml_data = {
 
            "status": status,
 
            "name": form.fullname.data,
 
            "birthday": form.birthday.data
 
            if form.birthday.data is not None
 
            else date(9999, 12, 12),
 
            "username": form.username.data,
 
            "email": form.email.data,
 
            "address": " ".join(
 
                (
 
                    form.street.data,
 
                    form.zip.data,
 
                    form.city.data,
 
                    form.state.data,
 
                    form.country.data,
 
                )
 
            ),
 
            "address": re.sub("\s+", " ", xml_data["address"]),
 
            "voting": 1 if form.membership.data == "regular" else 0,
 
            "date": now,
 
        }
 

	
 
        xml = xml_template.format(**xml_data)
 
        html = render_template(
 
            "member.html", form=form, price=price, year=year, xml=xml
 
            "member.html",
 
            form=form,
 
            price=price,
 
            year=now.year,
 
            xml=xml_template.format(**xml_data),
 
        )
 
        return render_pdf(HTML(string=html))
 

	
0 comments (0 inline, 0 general)