Add links to votes
This commit is contained in:
parent
ac2e4f0b62
commit
a9a778b4c3
17
app.py
17
app.py
|
@ -31,7 +31,22 @@ def home():
|
|||
log.debug("session = %s", session)
|
||||
if "user" not in session:
|
||||
return redirect(url_for("register", target="/"))
|
||||
return render_template("home.html")
|
||||
csr = get_cursor()
|
||||
csr.execute(
|
||||
"""
|
||||
select * from meet where id in (
|
||||
select meet from date_vote dv join date d on dv.date = d.id where bod = %(bod_id)s
|
||||
union
|
||||
select meet from time_vote tv join time t on tv.time = t.id where bod = %(bod_id)s
|
||||
union
|
||||
select meet from place_vote pv join place p on pv.place = p.id where bod = %(bod_id)s
|
||||
)
|
||||
order by id desc
|
||||
""",
|
||||
{"bod_id": session["user"]["id"]}
|
||||
)
|
||||
meets = csr.fetchall()
|
||||
return render_template("home.html", meets=meets)
|
||||
|
||||
@app.route("/register", methods=["GET", "POST"])
|
||||
def register():
|
||||
|
|
|
@ -6,14 +6,18 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>Hallo, {{ session.user.email }}!</p>
|
||||
<p>
|
||||
{{ session }}
|
||||
</p>
|
||||
<p>
|
||||
{{ session.user }}
|
||||
</p>
|
||||
<p>
|
||||
{{ session.user.1 }}
|
||||
</p>
|
||||
|
||||
{% for meet in meets %}
|
||||
{% if loop.first %}
|
||||
<ul>
|
||||
{% endif %}
|
||||
<li><a href="{{url_for("vote", key=meet.key)}}">{{meet.title}}</a></li>
|
||||
{% if loop.last %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p>(Du hast noch an keiner Abstimmung teilgenommen)</p>
|
||||
{% endfor %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue