Skip to content

Commit

Permalink
Hf
Browse files Browse the repository at this point in the history
  • Loading branch information
goors committed Nov 12, 2014
1 parent ca1d383 commit 76994d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CommentModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ def __init__(self):
self.cryptkey = appconfig.CRYPT_KEY


def comments(self):
def comments(self, post):

db = DB()
sql = '''SELECT * FROM Comment'''
sql = '''SELECT * FROM Comment WHERE Post=%s'''

query = db.query(sql)
query = db.query(sql, (post,))
comments = query.fetchall()

db.close()
Expand Down
5 changes: 3 additions & 2 deletions controllers/fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ def read(slug=None):
tag = TagModel()
post = PostModel()
comment = CommentModel()
id = post.getPostBySlug(slug)
if request.method == "POST":

if 'comment' in request.form:
id = post.getPostBySlug(slug)

comment.addcomment(request.form['comment'], request.form['email'], request.form['nick'], id)

return render_template("home/read.html", tags=tag.tags(), post=post.post(slug), comments = comment.comments())
return render_template("home/read.html", tags=tag.tags(), post=post.post(slug), comments = comment.comments(id))

#helper methods

Expand Down

0 comments on commit 76994d5

Please sign in to comment.