aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2015-03-17 09:14:47 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2015-03-17 09:14:47 -0400
commit901f8c9277be081c5d454e75c033c086311a95ea (patch)
tree64f57e9dfc833187d6898d37b0e2f42b32489dcc
parent839cc1b2a37a600677ab8ecbf14a7544f97ce5d4 (diff)
downloadwedding-website-901f8c9277be081c5d454e75c033c086311a95ea.tar.gz
update template
-rw-r--r--templates/en/rsvp.htm31
-rw-r--r--wedding.py4
2 files changed, 21 insertions, 14 deletions
diff --git a/templates/en/rsvp.htm b/templates/en/rsvp.htm
index 22b073a..fd1ea67 100644
--- a/templates/en/rsvp.htm
+++ b/templates/en/rsvp.htm
@@ -5,14 +5,14 @@
<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>
+ <p class="form-control-static">{{form['user_name']}}</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}}"/>
+ name="username" placeholder="{{form['full_name']}}"/>
</div>
</div>
<p style="text-indent:3em">
@@ -22,10 +22,12 @@
<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
+ <input type="radio" value="yes" name="rsvp"
+ {%if form['rsvp'] %}checked {% endif %}>Yes
</label>
<label class="radio-inline">
- <input type="radio" value="no" name="rsvp">No
+ <input type="radio" value="no" name="rsvp"
+ {%if not form['rsvp'] %}checked {% endif %}>No
</label>
</div>
</div>
@@ -33,13 +35,16 @@
<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}}"/>
+ name="email" placeholder=
+ "{{form['email'] if form['email'] is not none else '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"
+ <textarea id="mailing" name="mailing"
+ placeholder="{{mailing if form['mailing'] is not none
+ else 'Your mailing address'}}"
class="form-control" rows="3"></textarea>
</div>
</div>
@@ -50,10 +55,12 @@
<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
+ <input type="radio" value="yes" name="plusone"
+ {%if form['plusone'] %}checked {% endif %}>Yes
</label>
<label class="radio-inline">
- <input type="radio" value="no" name="plusone">No
+ <input type="radio" value="no" name="plusone"
+ {%if not form['plusone'] %}checked {% endif %}>No
</label>
</div>
</div>
@@ -61,7 +68,7 @@
<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}}"/>
+ name="plusonename" placeholder="{{form['plusonename']}}"/>
</div>
</div>
<p style="text-indent:3em">
@@ -71,10 +78,12 @@
<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
+ <input type="radio" value="yes" name="kids"
+ {%if form['kids'] %}checked {% endif %}>Yes
</label>
<label class="radio-inline">
- <input type="radio" value="no" name="kids">No
+ <input type="radio" value="no" name="kids"
+ {%if not form['kids'] %}checked {% endif %}>No
</label>
</div>
</div>
diff --git a/wedding.py b/wedding.py
index 181f3f0..7b042cb 100644
--- a/wedding.py
+++ b/wedding.py
@@ -47,9 +47,7 @@ def rsvp():
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])
+ form=r)
if request.method == 'POST':
db = get_db()
cur = db.execute("UPDATE guests set ", args)