summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-05-28 20:53:34 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-05-28 20:53:34 +0200
commite2741819830dc2afe4ad63810d468240ab1a2adb (patch)
tree636df8af19fe1d79bdc43ba4c868556d37df428c
parentd3d3a03ae3cda39a49033dbb9b096d6e2001e865 (diff)
downloadjokevote-e2741819830dc2afe4ad63810d468240ab1a2adb.tar.gz
jokevote-e2741819830dc2afe4ad63810d468240ab1a2adb.zip
fix form submits not working on pages
-rw-r--r--app.py6
-rw-r--r--templates/index.html6
2 files changed, 6 insertions, 6 deletions
diff --git a/app.py b/app.py
index 78c97f2..51059d1 100644
--- a/app.py
+++ b/app.py
@@ -50,13 +50,13 @@ class dbProxy(object):
def voteJoke(self, objectId, down):
if down:
- self.c.execute("UPDATE jokes SET downvotes=downvotes+1 WHERE id=?", (objectId))
+ self.c.execute("UPDATE jokes SET downvotes=downvotes+1 WHERE id=?", (objectId,))
else:
- self.c.execute("UPDATE jokes SET upvotes=upvotes+1 WHERE id=?", (objectId))
+ self.c.execute("UPDATE jokes SET upvotes=upvotes+1 WHERE id=?", (objectId,))
self.conn.commit()
def reportJoke(self, objectId):
- self.c.execute("UPDATE jokes SET reports=reports+1 WHERE id=?", (objectId))
+ self.c.execute("UPDATE jokes SET reports=reports+1 WHERE id=?", (objectId,))
self.conn.commit()
diff --git a/templates/index.html b/templates/index.html
index 277a948..f8bfa2c 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -16,12 +16,12 @@
<div class="row section valign-wrapper">
<div class="col s3 m2">
<div class="row">
- <form action="vote" method="post">
+ <form action="/vote" method="post">
<input type="hidden" name="id" value="{{ joke.id }}">
<button class="btn{% if joke.reports>0 %}-flat{% endif %} col s12" type="submit" name="vote" value="upvote"><i class="material-icons">thumb_up</i> {{ joke.upvotes }}</button>
<button class="btn{% if joke.reports>0 %}-flat{% endif %} col s12" type="submit" name="vote" value="downvote"><i class="material-icons">thumb_down</i> {{ joke.downvotes }}</button>
</form>
- <form action="report" method="post">
+ <form action="/report" method="post">
<input type="hidden" name="id" value="{{ joke.id }}">
<button class="btn-flat col s12" type="submit">
{% if joke.reports>0 %}
@@ -53,7 +53,7 @@
</div>
<div class="divider hide-on-small-only"></div>
<div class="section hide-on-small-only">
- <form action="submit" method="post">
+ <form action="/submit" method="post">
<div class="row valign-wrapper">
<div class="col s10 input-field">
<label for="text">Neuen Spruch hinzufügen</label>