Changeset - f3d6dfa3b589
[Not reviewed]
version_5
0 3 0
Dennis Fink - 10 years ago 2015-07-21 22:41:10
dennis.fink@c3l.lu
Backout 05866e023ce5
3 files changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/views.py
Show inline comments
 
@@ -26,14 +26,15 @@ def snailmail():
 
    current_app.logger.info('Handling snailmail')
 
    form = BPMForm()
 
    country_choices = [choice[0] for choice in form.country.choices]
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        country = form.country.data
 
        return redirect(url_for('donate.snailmail', country=country))
 
        if form.validate_on_submit():
 
            country = form.country.data
 
            return redirect(url_for('donate.snailmail', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
ennstatus/root/forms.py
Show inline comments
 
from flask_wtf import Form
 
from wtforms import SelectField, StringField, RadioField, BooleanField, SubmitField
 
from wtforms.validators import InputRequired, Email, Length, DataRequired
 

	
 

	
 

	
 
COUNTRIES = [
 
    ('luxembourg', 'Luxembourg'),
 
    ('united_kingdom', 'United Kingdom'),
 
    ('united_states', 'United States of America'),
 
    ('belgium', 'Belgium'),
 
    ('france', 'France'),
 
    ('germany', 'Germany'),
 
]
 

	
 

	
 
class BPMForm(Form):
 
    country = SelectField('Country',
 
                          validators=[DataRequired()],
 
                          choices=COUNTRIES)
 

	
 

	
 
class MembershipForm(Form):
 

	
 
    username = StringField('Username*',
ennstatus/root/views.py
Show inline comments
 
@@ -59,14 +59,15 @@ def contact():
 
    current_app.logger.info('Handling contact')
 
    form = BPMForm()
 
    country_choices = [choice[0] for choice in form.country.choices]
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        country = form.country.data
 
        return redirect(url_for('root.contact', country=country))
 
        if form.validate_on_submit():
 
            country = form.country.data
 
            return redirect(url_for('root.contact', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
0 comments (0 inline, 0 general)