コード例 #1
0
def story(title):
    storynames = dataconnector.getTaleTitles()
    lines = dataconnector.getStory(title)
    if request.method == 'POST':
        btn = request.form['button']

        if btn == 'Add':
            entry = request.form['entry']
            dataconnector.addLineToStory(title,entry)
            lines = dataconnector.getStory(title)
        elif btn == 'Return':
            return redirect(url_for('home'))

    
    return render_template('stories.html', title = title, lines = dataconnector.getStory(title))
コード例 #2
0
def home():
    #if request.method == 'GET':
    #    TaleTitles = dataconnector.getTaleTitles()
    #    return render_template('home.html',TaleTitles=TaleTitles)
    
    if request.method == 'POST':
        
        btn = request.form['button']
        if btn == 'BEGIN!':
            newTitle = (str)(request.form['newstory'])
            dataconnector.createNewTale(newTitle)
            return redirect(url_for('home'))
    
        if btn == 'GO!':
            storyTitle = request.form['story']
            lines = dataconnector.getStory(storyTitle)
            return redirect(url_for('story', title = storyTitle, lines = lines))

        if btn == 'DELETE ALL':
            dataconnector.clearStories()

    TaleTitles = dataconnector.getTaleTitles()
    return render_template('home.html',TaleTitles=TaleTitles)