Changeset - da5aec72d77a
[Not reviewed]
version_5
6 1 0
Dennis Fink - 9 years ago 2015-10-11 18:43:36
dennis.fink@c3l.lu
Remove uneeded donate pages
7 files changed with 2 insertions and 316 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/views.py
Show inline comments
 
from flask import (Blueprint, render_template, request,
 
                   redirect, url_for, current_app)
 

	
 
from ennstatus.donate.forms import DateForm
 
from ennstatus.donate.functions import load_csv, get_choices
 

	
 
from ennstatus.root.forms import BPMForm
 
from ennstatus.root.constants import BPM_ADDRESSES
 

	
 
donate_page = Blueprint('donate', __name__)
 

	
 

	
 
@donate_page.route('/')
 
@donate_page.route('/', methods=('GET', 'POST'))
 
def index():
 
    return render_template('donate/index.html')
 

	
 

	
 
@donate_page.route('/wiretransfer')
 
def wiretransfer():
 
    return render_template('donate/wiretransfer.html')
 

	
 

	
 
@donate_page.route('/snailmail', methods=('GET', 'POST'))
 
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')
 
        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:
 
                current_app.logger.warn('Country %s not found' % country)
 
                country = 'luxembourg'
 
        else:
 
            current_app.logger.info('Using default country')
 
            country = 'luxembourg'
 

	
 
    form.country.data = country
 
    address = BPM_ADDRESSES[country]
 

	
 
    return render_template('donate/snailmail.html', form=form, address=address)
 

	
 

	
 
@donate_page.route('/paypal')
 
def paypal():
 
    return render_template('donate/paypal.html')
 

	
 

	
 
@donate_page.route('/bitcoin')
 
def bitcoin():
 
    return render_template('donate/bitcoin.html')
 

	
 

	
 
@donate_page.route('/flattr')
 
def flattr():
 
    return render_template('donate/flattr.html')
 

	
 

	
 
@donate_page.route('/bpm')
 
def bpm():
 
    return render_template('donate/bpm.html')
 
    return render_template('donate/index.html', form=form, address=address)
 

	
 

	
 
@donate_page.route('/received',
 
                   methods=('GET', 'POST'))
 
def received():
 

	
 
    current_app.logger.info('Handling received')
 
    form = DateForm()
 

	
 
    current_app.logger.debug('Creating choices')
 

	
 
    files = [name for name in get_choices()]
 
    files.sort()
 

	
 
    year_choices = list({name.split('-')[0] for name in files})
 
    year_choices.sort()
 
    form.year.choices = [(name, name) for name in year_choices]
 

	
 
    if not year_choices:
 
        current_app.logger.warn('No donations found!')
 
        return render_template('donate/received.html',
 
                               form=form, csv_file=None,
 
                               year=None, month=None)
 

	
ennstatus/templates/donate/bitcoin.html
Show inline comments
 
deleted file
ennstatus/templates/donate/bpm.html
Show inline comments
 
deleted file
ennstatus/templates/donate/flattr.html
Show inline comments
 
deleted file
ennstatus/templates/donate/paypal.html
Show inline comments
 
deleted file
ennstatus/templates/donate/snailmail.html
Show inline comments
 
deleted file
ennstatus/templates/donate/wiretransfer.html
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)