Example #1
0
def new_post(title, abstract, content,tags):
        # Create a new article given all the parameters
	post = {}
	post["title"] = title
	post["abstract"] = abstract
	post["content"] = content
        post["tags"] = parse_tags(tags)
        post["draft"] = True
        post["date"] = datetime.datetime.now().strftime("%d %B, %Y")
	post["id"] = sluggize(title)
	db.articles.save(post)
        inc_tags(tags, db)
Example #2
0
def edit_post(title, abstract, content, tags, article):
        # Edit an article
	id = article["_id"]
        update_tags(article["tags"], parse_tags(tags), db)
	db.articles.update({"_id":id},{"$set": {"title":title, "abstract":abstract, "content":content,"tags":parse_tags(tags)}})