diff --git a/src/posts.py b/src/posts.py index 15dd460..c16e022 100644 --- a/src/posts.py +++ b/src/posts.py @@ -1,6 +1,8 @@ #! /usr/bin/python import couchdb + +from couchdb.http import ResourceConflict, ResourceNotFound from flask import jsonify from flask_marshmallow import Marshmallow @@ -51,4 +53,11 @@ class Posts: return jsonify(self.db[_id]) def delete(self, _id): - return self.db[_id].delete() + doc = self.db[_id] + try: + self.db.delete(doc) + return jsonify(True) + except (ResourceNotFound, ResourceConflict) as e: + print(e) + return jsonify(False) + diff --git a/src/scripts/editor.tag b/src/scripts/editor.tag index bec183b..34301a7 100644 --- a/src/scripts/editor.tag +++ b/src/scripts/editor.tag @@ -24,7 +24,17 @@ > Next +

+ title + author + Editing post {this.currentPost()._id}

+