From 543736704bfa0c70aef6094809009237e5584d9b Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 2 Jul 2021 13:14:46 -0700 Subject: [PATCH] start working on accepting tx and subscription info --- xmrbackers/forms.py | 5 +++++ xmrbackers/routes/creator.py | 15 ++++++++++++++- xmrbackers/templates/creator/subscription.html | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/xmrbackers/forms.py b/xmrbackers/forms.py index cf300fe..7db15cb 100644 --- a/xmrbackers/forms.py +++ b/xmrbackers/forms.py @@ -7,3 +7,8 @@ from wtforms.validators import DataRequired class UserAuth(FlaskForm): username = StringField('Username:', validators=[DataRequired()], render_kw={"placeholder": "Username", "class": "form-control", "type": "text"}) password = StringField('Password:', validators=[DataRequired()], render_kw={"placeholder": "Password", "class": "form-control", "type": "password"}) + +class ConfirmSubscription(FlaskForm): + tx_id = StringField('TX ID:', validators=[DataRequired()], render_kw={"placeholder": "TX ID", "class": "form-control", "type": "text"}) + tx_key = StringField('TX Key:', validators=[DataRequired()], render_kw={"placeholder": "TX Key", "class": "form-control", "type": "text"}) + wallet_address = StringField('XMR Address:', validators=[DataRequired()], render_kw={"placeholder": "XMR Address", "class": "form-control", "type": "text"}) diff --git a/xmrbackers/routes/creator.py b/xmrbackers/routes/creator.py index f77c938..a40365d 100644 --- a/xmrbackers/routes/creator.py +++ b/xmrbackers/routes/creator.py @@ -1,5 +1,6 @@ from quart import Blueprint, render_template, flash, redirect, url_for +from xmrbackers.forms import ConfirmSubscription from xmrbackers.models import User, CreatorProfile, TextPost, SubscriptionMeta @@ -42,10 +43,22 @@ async def subscription(username): subscription_meta = SubscriptionMeta.select().where( SubscriptionMeta.creator == creator ).order_by(SubscriptionMeta.create_date.desc()).first() + form = ConfirmSubscription() return await render_template( 'creator/subscription.html', - subscription_meta=subscription_meta + subscription_meta=subscription_meta, + form=form ) else: await flash('That creator does not exist.') return redirect(url_for('meta.index')) + +@bp.route('/subscription//confirm', methods=['POST']) +async def confirm_subscription(creator_id): + form = ConfirmSubscription() + if form.validate_on_submit(): + + return redirect(url_for('meta.index')) + else: + await flash('Unable to accept form POST.') + return redirect(url_for('meta.index')) diff --git a/xmrbackers/templates/creator/subscription.html b/xmrbackers/templates/creator/subscription.html index a846fe5..c426d01 100644 --- a/xmrbackers/templates/creator/subscription.html +++ b/xmrbackers/templates/creator/subscription.html @@ -15,6 +15,24 @@

XMR: {{ subscription_meta.atomic_xmr | from_atomic }}

Address: {{ subscription_meta.wallet_address }}

Hours: {{ subscription_meta.number_hours }}

+
+ {% for f in form %} + {% if f.name == 'csrf_token' %} + {{ f }} + {% else %} +
+ {{ f.label }} + {{ f }} +
+ {% endif %} + {% endfor %} +
    + {% for field, errors in form.errors.items() %} +
  • {{ form[field].label }}: {{ ', '.join(errors) }}
  • + {% endfor %} +
+ +
{% endif %} {% include 'includes/footer.html' %}