From 87aa15a94568a42648a9942637780b4522f6ff58 Mon Sep 17 00:00:00 2001 From: wes Date: Sun, 18 Jun 2017 14:47:24 -0400 Subject: [PATCH] updating works now --- src/posts.py | 16 ++++++++++------ src/scripts/editor.tag | 10 ++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/posts.py b/src/posts.py index b36e24c..61b5059 100644 --- a/src/posts.py +++ b/src/posts.py @@ -16,13 +16,17 @@ class Posts: self.db = self.client["blog"] def savepost(self, title="", content="", author="", _id=False): - doc = { - "title" : title, - "content" : content, - "author" : author - } if _id: - doc["_id"] = _id + doc = self.db[_id] + doc["title"] = title + doc["content"] = content + doc["author"] = author + else: + doc = { + "title" : title, + "content" : content, + "author" : author + } return jsonify(self.db.save(doc)) diff --git a/src/scripts/editor.tag b/src/scripts/editor.tag index e0af418..5b41048 100644 --- a/src/scripts/editor.tag +++ b/src/scripts/editor.tag @@ -5,7 +5,7 @@