Esempio n. 1
0
def add_payment():
    if not current_user.has_permission('financial.payments'):
        abort(403)

    form = PaymentAddForm(request.form)

    if request.method == "POST":

        payment = PaymentTransaction()

        payment.amount = form.amount.data
        payment.period_begin = form.start_date.data
        payment.period_end = form.end_date.data
        payment.user = current_user.to_dbref()
        payment.note = form.note.data

        payment.save()

        return redirect(url_for('donations.donate'))

    return render_template("add_payment.html", form=form)
Esempio n. 2
0
def payments_view():
    payments = PaymentTransaction.objects().order_by('+period_begin')

    return render_template('payments_view.html', payments=payments)