diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2015-03-16 21:58:53 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2015-03-16 21:59:41 -0400 |
| commit | 839cc1b2a37a600677ab8ecbf14a7544f97ce5d4 (patch) | |
| tree | 4db039ddb9c2a69abff3ab59a03114146f8654da | |
| parent | 617e94af33251173c4327351d488471fe17ca655 (diff) | |
| download | wedding-website-839cc1b2a37a600677ab8ecbf14a7544f97ce5d4.tar.gz | |
start working on rsvp route
| -rw-r--r-- | templates/en/rsvp.htm | 100 | ||||
| -rw-r--r-- | wedding.py | 15 |
2 files changed, 114 insertions, 1 deletions
diff --git a/templates/en/rsvp.htm b/templates/en/rsvp.htm new file mode 100644 index 0000000..22b073a --- /dev/null +++ b/templates/en/rsvp.htm @@ -0,0 +1,100 @@ +{%extends 'layout.htm' %} +{% block content%} +<form id="rsvp" action="/rsvp/" role="form" + class="form-horizontal" method="post"> + <div class="form-group"> + <label for="name" class="col-md-2 control-label">Username:</label> + <div class="col-md-5"> + <p class="form-control-static">{{username}}</p> + </div> + </div> + <div class="form-group"> + <label for="fullname" class="col-md-2 control-label">Full Name:</label> + <div class="col-md-5"> + <input type="text" id="fullname" class="form-control" + name="username" placeholder="{{fullname}}"/> + </div> + </div> + <p style="text-indent:3em"> + Will you be able to make it to our wedding? + </p> + <div class="form-group"> + <label for="answer" class="col-md-2 control-label">RSVP:</label> + <div class="col-md-9"> + <label class="radio-inline"> + <input type="radio" value="yes" name="rsvp" checked>Yes + </label> + <label class="radio-inline"> + <input type="radio" value="no" name="rsvp">No + </label> + </div> + </div> + <div class="form-group"> + <label for="email" class="col-md-2 control-label">Email:</label> + <div class="col-md-5"> + <input type="email" id="email" class="form-control" + name="email" placeholder="{{email}}"/> + </div> + </div> + <div class="form-group"> + <label for="mailing" class="col-md-2 control-label">Mailing Address:</label> + <div class="col-md-5"> + <textarea id="mailing" name="mailing" placeholder="Your mailing address" + class="form-control" rows="3"></textarea> + </div> + </div> + <p style="text-indent:3em"> + Will you be accompanied by a plus one? + </p> + <div class="form-group"> + <label for="plusone" class="col-md-2 control-label">+1:</label> + <div class="col-md-9"> + <label class="radio-inline"> + <input type="radio" value="yes" name="plusone" checked>Yes + </label> + <label class="radio-inline"> + <input type="radio" value="no" name="plusone">No + </label> + </div> + </div> + <div class="form-group"> + <label for="mailing" class="col-md-2 control-label">+1's Full Name:</label> + <div class="col-md-5"> + <input type="text" id="plusonename" class="form-control" + name="plusonename" placeholder="{{plusonename}}"/> + </div> + </div> + <p style="text-indent:3em"> + Will you be coming with kids? + </p> + <div class="form-group"> + <label for="plusone" class="col-md-2 control-label">Kids:</label> + <div class="col-md-9"> + <label class="radio-inline"> + <input type="radio" value="yes" name="kids" checked>Yes + </label> + <label class="radio-inline"> + <input type="radio" value="no" name="kids">No + </label> + </div> + </div> + <div class="form-group"> + <label for="mailing" class="col-md-2 control-label">Kids' names:</label> + <div class="col-md-5"> + <textarea id="kidsnames" name="kidsnames" placeholder="Your kids' names" + class="form-control" rows="3"></textarea> + </div> + </div> + <p style="text-indent:3em"> + Please let us know if you have any dietary restrictions or comments: + </p> + + <div class="form-group"> + <label for="mailing" class="col-md-2 control-label">Comments:</label> + <div class="col-md-5"> + <textarea id="comments" name="comments" placeholder="Your comments" + class="form-control" rows="3"></textarea> + </div> + </div> +</form> +{% endblock %} @@ -41,6 +41,19 @@ def login_required(f): return f(*args, **kwargs) return decorated_function +@app.route('/rsvp/', methods=['GET', 'POST']) +def rsvp(): + if request.method == 'GET': + r = query_db("SELECT * from guests where user_name=?", + (session["user_name"],), one=True) + return render_template("{0}/rsvp.htm".format(session["lang"]), + username=session["user_name"], + lang=session["lang"], + fullname=r[2]) + if request.method == 'POST': + db = get_db() + cur = db.execute("UPDATE guests set ", args) + @app.route('/') @app.route('/home/') @login_required @@ -57,7 +70,7 @@ def login(): error = None if request.method == 'POST': session['user_name'] = request.form['username'] - password = hashlib.md5(request.form['password']).hexdigest() + #password = request.form['password'].hexdigest() session['lang'] = request.form['language'] return redirect(url_for('main_page')) return render_template('login.htm') |
