Ejemplo n.º 1
0
def story_page(story):
    if request.method=='GET':
        comments = mongo2.getComments(story)
        return render_template("storypage.html", story=story, comments=comments)
    else:
        button = request.form['button']
        if button == "Back":
            return redirect("/")
        if button == "New Comment":
            comment = request.form["comment"]
            if comment != "":
                mongo2.addComment(story,comment)
        comments = mongo2.getComments(story)
        return render_template("storypage.html", story=story, comments=comments)
Ejemplo n.º 2
0
import pymongo
from pymongo import Connection
import mongo2

mongo2.newStory("New Story")
mongo2.newStory("NEWER STORY")
mongo2.newStory("NEWEST STORY")
mongo2.addComment("New Story","NEW COMMENT")
mongo2.addComment("NEWEST STORY","WHAT")
print "\n"
print mongo2.getStories()
print "\n\n"
print mongo2.getComments("New Story")
print "\n"
print mongo2.getComments("NEWEST STORY")
mongo2.deleteAll()