diff --git a/src/posts.py b/src/posts.py index 663f792..b36e24c 100644 --- a/src/posts.py +++ b/src/posts.py @@ -15,12 +15,15 @@ class Posts: self.db = self.client["blog"] - def savepost(self, title="", content="", author=""): + def savepost(self, title="", content="", author="", _id=False): doc = { "title" : title, "content" : content, "author" : author } + if _id: + doc["_id"] = _id + return jsonify(self.db.save(doc)) def getposts(self, limit, start): diff --git a/src/scripts/editor.tag b/src/scripts/editor.tag index 9e3c77e..e0af418 100644 --- a/src/scripts/editor.tag +++ b/src/scripts/editor.tag @@ -7,11 +7,16 @@

{title} by {author}, id = {_id}

- + title author + Editing post {_id}