Changeset - 126a345d5816
[Not reviewed]
default
0 2 0
Dennis Fink - 10 years ago 2014-12-12 14:26:29
dennis.fink@c3l.lu
Also enable address selection in donate.snailmail
2 files changed with 45 insertions and 5 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('/')
 
def index():
 
    return render_template('donate/index.html')
 

	
 

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

	
 

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

	
 
    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')
 

	
 

	
ennstatus/templates/donate/snailmail.html
Show inline comments
 
@@ -4,26 +4,38 @@
 

	
 
{% block content %}
 
  <div class="col-md-4 text-center">
 
    <img src="{{ url_for('static', filename='images/SnailMail.png') }}" class="img-rounded" alt="SnailMail" width="135" height="135">
 
    <h2>Snailmail</h2>
 
  </div>
 
  <div class="col-md-8">
 
    <blockquote>
 
      <p>"<em>This may be the purest form of democracy the world has ever known, and I — for one — am thrilled to be here to watch it unfold.</em>"</p>
 
      <small>Paco Ahlgren<citi"Source Title"></cite></small>
 
    </blockquote>
 

	
 
    <div class="pull-right">
 
      <form class="form-inline" role="form" method="POST" action="{{ url_for('donate.snailmail') }}">
 
        {{ form.hidden_tag() }}
 
        <div class="form-group">
 
          {{ form.country.label }}
 
          {{ form.country(_class="form-control") }}
 
        </div>
 
        <input type="submit" class="btn btn-primary btn-sm" value="Submit">
 
      </form>
 
    </div>
 
    <div class="clearfix"></div>
 
    <br>
 
    <p><strong>SnailMail</strong> is most probably, the most anonymous way to support us - as long as you debit / change the money anonymously and touch it without your fingerprints.</p>
 
    <!-- <p class="bg-info text-center">
 
      <strong>Either donate direclty to us, or proxy your money through one of our partner addresses.</strong>
 
    </p> --!>
 
		  
 
		<address>
 
      <strong>Frënn vun der Ënn, ASBL</strong><br>
 
		          BPM 381892<br>
 
      		    34, Rue Gabriel Lippmann<br>
 
		          L-5365, Munsbach<br>
 
      		    Luxembourg, Europe, Earth<br>
 
              {{ address['address'] }}<br>
 
              {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
              {{ address['country'] }}<br>
 
		</address>
 
  </div>
 
{% endblock %}
0 comments (0 inline, 0 general)