def removeComment(comment_id): comment = dao.getObject(comment_id, Comment) if comment.user != current_user: return redirect(request.referrer or url_for('index')) dao.deleteObject(comment) dao.commit() flash("Yorum silindi!", 'info') return redirect(request.referrer or url_for('bookPage', book_id=comment.book.id))
def removeNote(note_id): note = dao.getObject(note_id, Note) if note.user != current_user: return redirect(request.referrer or url_for('index')) dao.deleteObject(note) dao.commit() flash("Not silindi!", 'info') return redirect(request.referrer or url_for('bookPage', book_id=note.book.id))
def deleteSummary(assoc_id): assoc = dao.getObject(assoc_id, UserBook) if assoc is None or assoc not in current_user.book_assocs or assoc.status != Status.have_read or assoc.summary == None: flash(u'Var olmayan bir özeti silemezsiniz!', 'warning') return redirect(request.referrer or url_for('index')) dao.deleteObject(assoc.summary) dao.commit() flash(u'Özet silindi!', 'info') return redirect(url_for('index'))
def removeGoal(): if current_user.reading_goal is not None: dao.deleteObject(current_user.reading_goal) dao.commit() return redirect(url_for('index'))