Commit 72e5ab00 authored by Martin Mareš's avatar Martin Mareš
Browse files

Smazání příspěvku studentem smaže i přílohu

Closes #31.
parent ee939716
......@@ -658,14 +658,16 @@ def edit_post(sident, cident, pid):
flash('Post deleted.', 'info')
return redirect(return_to)
cmt = "*Post deleted by its author.*"
att = None
points = None
else:
cmt = strip_comment(form.comment.data)
att = post.attachment
points = form.points.data
changed = False
if cmt != post.comment:
db_query("UPDATE owl_posts SET comment=%s WHERE pid=%s", (cmt, pid))
if cmt != post.comment or att != post.attachment:
db_query("UPDATE owl_posts SET comment=%s, attachment=%s WHERE pid=%s", (cmt, att, pid))
changed = True
if g.is_grader and points != post.points:
db_query("UPDATE owl_posts SET points=%s WHERE pid=%s", (points, pid))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment